WooCommerce: Remove Tax @ Checkout if Field Value Exists

You can use to exempt someone from Tax/VAT if they enter a Tax/VAT number, or maybe if they specify a given ZIP code.

When I discovered the WooCommerce function set_is_vat_exempt(), together with a little trick to “get” a checkout field programmatically, the snippet was pretty simple to build and test. Here’s the lovely piece of code 🙂

WooCommerce: zero tax/vat if ZIP code equals ‘XYZ’

PHP Snippet: Remove Tax @ WooCommerce Checkout if Field Value Exists

 * @snippet       Remove Tax @ Checkout if Field Value Exists - WooCommerce
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=21952
 * @author        Rodolfo Melogli
 * @compatible    WC 2.6.14, WP 4.7.2, PHP 5.5.9
add_action( 'woocommerce_checkout_update_order_review', 'bbloomer_taxexempt_checkout_based_on_zip');
function bbloomer_taxexempt_checkout_based_on_zip( $post_data ) {
        global $woocommerce;
        $woocommerce->customer->set_is_vat_exempt( false );
        if ( $billing_postcode == '32444' ) $woocommerce->customer->set_is_vat_exempt( true );

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (and in case of CSS, this goes at the bottom of the style.css file) – if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Did this snippet work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise 🙂

And if you think this code saved you time & money, please join the other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance! Rodolfo

Mostakim Hossen

I am Mostakim Hossain, a Web designer and developer, 23 years of age. I have been working as a freelance (upwork) for almost 2 years now and I will be glad in helping you create your next awesome project.

I have created lots of public and private websites(some shown below) and always looking for more work to learn from. I am using PHP as my primary programming language. You can see my skill set beside this text.

I am a person who is willing to learn and adapts quickly. I am keen to design and security. I believe in the core principles of Open Source and support it. I have a minimalist approach to design and usability. Simplicity is beauty they say.
Masters of Accountancy : Asian University of Bangladesh
I’m here to answer any questions you might have about our products and services. Feel free to contact me using any of the following methods:

Email : support@smarterdevs.com

This Post Has 2 Comments
  1. Solaiman Talukder
    We are punctual and motivated individual who is able to work in a busy environment and produce high standards of work. We believe our work speaks for itself. Our developers are available 24/7 to fix any small jobs, Unlimited Support 24/7 Security Monitoring, WordPress Core Updates, Theme & Plugins Updates, Unlimited Fixing, Broken Link Check, Monthly Full Backup, 10+ Blog Posts, 5+ WooProducts Upload, Spam & Revisions Cleanup, Weekly Manual Updates, Performance Scans, Email Support, On Page SEO, Weekly Security Scans, Site Transfer, Monthly Report maintenance websites from $39/month.


  2. Blog commenting is still a valid link building technique that can help your SEO, brand reputation and building relationships.

    Most blog comments are no-follow links but they could help you get traffic, exposure, brand awareness and even can lead to earn you the do-follow links. There are also chances that the blog author can edit his/her post to include that link if it adds some value or additional information to the blog post. Also, if Google sees that if there is a healthy and relevant conversation, it can provide the site the ranking benefits. Recently, Google has pulled out the content from comment section in their featured snippet for “how much is gap insurance” query.


Leave a Reply

Your email address will not be published. Required fields are marked *


Coupon : happynewyear

60% OFF

Stay updated with all latest updates,upcoming plugins & much more.
WordPress Themes