Skip to content

Instantly share code, notes, and snippets.

@aadityajs
Forked from mikejolley/gist:5568708
Created January 3, 2014 10:14
Show Gist options
  • Save aadityajs/8235774 to your computer and use it in GitHub Desktop.
Save aadityajs/8235774 to your computer and use it in GitHub Desktop.
Apply tax based on subtotal
<?php
add_filter( 'woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2 );
function big_apple_get_tax_class( $tax_class, $product ) {
global $woocommerce;
if ( $woocommerce->cart->subtotal <= 110 )
$tax_class = 'Zero Rate';
return $tax_class;
}
?>
@sachin447
Copy link

Hi,

your formula is working for me but I also want to set state too along with subtotal. How I can do this ? I want to use tax class as Zero if customer is from New York and subtotal is <= 110.

Any help ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment