How to disable VAT for specific countries on WooCommerce checkout

If you’re running a B2B WooCommerce Store it can be usefull to be able to disable VAT and it’s calculation on checkout page. To do so you can either use a plugin or you add a simple lightweight function to youtr (child-)themes functions.php:

function extempt_vat_for_non_eu_firms( $post_data ) {

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

  parse_str( $post_data, $output );

  $countries_without_vat = array('DE','ES','FR');

  if(in_array($output['billing_country'], $countries_without_vat)) {
    WC()->customer->set_is_vat_exempt( true );
  }
}
add_action( 'woocommerce_checkout_update_order_review', 'extempt_vat_for_non_eu_firms' );

In this example VAT has been disabled for Germany (DE), France (FR) and Spain (ES). You can extend this code for your own personal needs of course. This way you can use every other checkout field and build conditions with it.

Leave a Comment

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