Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active July 5, 2024 16:51
Show Gist options
  • Save woogists/bb02074645cf28b32f367f0dc01fb171 to your computer and use it in GitHub Desktop.
Save woogists/bb02074645cf28b32f367f0dc01fb171 to your computer and use it in GitHub Desktop.
Apply WooCommerce tax based on the subtotal
<?php
add_filter( 'woocommerce_product_get_tax_class', 'big_apple_get_tax_class', 1, 2 );
function big_apple_get_tax_class( $tax_class, $product ) {
if ( WC()->cart->subtotal <= 110 )
$tax_class = 'Zero Rate';
return $tax_class;
}
@firefrog11
Copy link

Hello. Im trying to use this code on my Wordpress WooCommerce shop because im based in France but will be selling to the uk.
Unfortunately I don't know how to get it to work, I've used snippet to add it to my site but I don't really know what im doing.
Would someone be kind enough to give me some instructions on how to get this to work.
Any help is greatly appreciated.
Ben

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