How to Hide Tax Label In WooCommerce

WooCommerce Hide Tax Label

Do you want to remove the “ex. tax” label that appears in the order details on invoices?

In this brief tutorial, I will walk you through how to hide the tax label.

If your WooCommerce store sells items excluding tax, you do not require a notice that pricing is excluding tax, especially if the invoice contains a tax line item.

WooCommerce Hide Tax Label

In the US, subtotals are usually displayed exclusive of tax.

The tax is included as a line item on invoices.

This means that stores that sell only within the US do not typically need this label in email invoices.

It is very easy to hide the WooCommerce tax label, i.e. “(ex. tax)”, if you are familiar with PHP code.tax label

Hiding the Tax Label in WooCommerce

The first thing is to figure out where that “(ex. tax)” label comes from by analyzing the functions.

The order totals are generated from the get_order_item_totals() function in the email template itself. Therefore, we cannot remove this from the template. This is because it adds both the amount for the subtotal and the label.

Moreover, we will not be able to change the WooCommerce tax label here. However, we can find the core code’s function to see if we can change what is returned for the label.

The get_order_item_totals() function is made up of several parts. It is worth mentioning that the subtotal and its label aren’t generated here, but the subtotal is displayed by the get_subtotal_to_display() function.

The tax label is generated as part of the get_subtotal_to_display() function. This function gets the subtotal value, and the subtotal will be formatted with an excluding tax label if prices are displayed, excluding tax.

The label is generated in this function from another function called the ex_tax_or_vat() function. The next step is to create a filter that we can use to change the returned label. We can modify it to hide the tax label.

The woocommerce_countries_ex_tax_or_vat filter generates the label used in the subtotal, tax-exclusive display. Therefore, it is used in all email templates.

Steps to Hide the Tax Label in WooCommerce

Here are the steps you need to follow to hide the tax label.

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to add the function to hide the tax on the checkout page if the field value exists.
  3. Add the following code to the functions.php file:
function njengah_change_email_tax_label( $label ) {

    $label = '';

    return $label;

}

add_filter( 'woocommerce_countries_ex_tax_or_vat', 'njengah_change_email_tax_label' );
  1. Now the order details table will return only amounts without a label included to indicate that prices are displayed exclusive of tax:

Conclusion

This post shares how you can easily remove the “(ex. tax)” label that appears in the order details on invoices.

Moreover, breaking up functions ensures that they can easily be used in different contexts. However, it can be a little bit tricky to see where a label or value comes from sometimes. You can typically use this technique with many WooCommerce changes, as I have illustrated in this article.

Similar Articles