How to hide VAT label and value from WooCommerce order emails?

I want to hide or remove VAT (tax) line from WooCommerce order emails. Result comes out from this function “get_order_item_totals()”. Already I can hide tax label from emails by using following code.

function sv_change_email_tax_label( $label ) {
    $label = '';
    return $label;
}
add_filter( 'woocommerce_countries_tax_or_vat', 'sv_change_email_tax_label'       );

I want to hide the entire row of VAT from order emails.

Related posts

2 comments

  1. Finally figured out a way do this. “get_order_item_totals()” function returns an Array of arrays. so i unset() the unwanted array. in this case $totals[tax]
    following is my code in email template.

    <?php
        if ( $totals = $order->get_order_item_totals() ) {              
           unset($totals[tax]);
           $i = 0;
           foreach ( $totals as $total ) {                  
           $i++;                    
         ?><tr>
           <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
           <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
    </tr><?php                  
          }
       }
     ?>
    

    Thank you very much everyone who tried to help!
    Regards!

  2. Depending on the status of the order, you’ll need to edit the relevant email template.

    For eg: If you have COD payment method enabled and the customer selected that option, the order status will be “Processing”, in that case you need to edit customer-processing-order.php template.

    //find this line and after it add the following line of code                
    foreach ( $totals as $total ) {  
    
        //ensure to change "VAT" with the label that appears on your email
        if( strstr( $total['label'], "VAT" ) )  continue; 
    

Comments are closed.