How to Hide Tax On Checkout In WooCommerce

WooCommerce Hide Tax on Checkout if Field Value Exists

Whether you are selling digital products or physical goods, you must leverage the WooCommerce built-in tax system unless you are well-versed in dealing with online sales tax protocols.

Manually determining appropriate tax rates is challenging.

WooCommerce Hide Tax On Checkout If Field Value Exists

The WooCommerce built-in tax system located within your WooCommerce Dashboard automates this essential accounting process.

This option can be accessed by going to your WooCommerce Dashboard > Settings > Tax.

However, remember to enable this option by clicking “Enable taxes and tax calculations” found in the General tab.

On the settings page, you can choose the pricing options that work best for your accounting methodology.

Exclusive tax means that the displayed base price for a product does not include tax.

Inclusive tax means that the base price includes tax in the displayed base price.

Moreover, I highly recommend that you review your WooCommerce tax reports quarterly.

Hiding the Tax on the Checkout Page if Field Value Exists.

There is a WooCommerce function that allows you to exempt someone from Tax/VAT calculations. For example, you can enable exemption once they enter a Tax/VAT number, or maybe if they specify a given ZIP code.

This function is called set_is_vat_exempt(), and together with a little trick to “get” a checkout field on the go.

This is how tax is displayed on the checkout page:tax displayed on the checkout

Here are the steps you need to follow:

  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.
  3. 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.
  4. Add the following code to the functions.php file:
/**

 *        Remove Tax if Field Value Exists - WooCommerce Checkout

*/

  add_action( 'woocommerce_checkout_update_order_review', 'njengah_taxexempt_checkout_based_on_zip' );




function njengah_taxexempt_checkout_based_on_zip( $post_data ) {

        WC()->customer->set_is_vat_exempt( false );

        parse_str( $post_data, $output );

        if ( $output['billing_postcode'] === '32444' ) WC()->customer->set_is_vat_exempt( true );

}
  1. This is the outcome:

Conclusion

In this post, I have highlighted that one of the essential steps you take while setting up an online store is working out taxes.

Moreover, I have shown you how to hide the tax on the checkout page if the field value exists.

However, it is worth mentioning that WooCommerce attempts to provide settings as straightforwardly as possible to make the process easier.

Similar Articles

  1. How to Move Primary Menu Storefront WooCommerce