WooCommerce Tax Filter Not Fired

Question

I’m want to apply zero tax when sum is less than 100, but this code is not fired (I don’t see print to console or echo is source).
I added this to the code snippets plugin. What am I doing wrong?

add_filter( 'woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2 );

function big_apple_get_tax_class( $tax_class, $product ) {
        echo "<script>console.log('Debug Objects' );</script>";

    global $woocommerce;
    $cart_subtotal = $woocommerce->cart->get_cart_subtotal();
    if ( $cart_subtotal <= 100 )
        $tax_class = 'Zero Rate';

    return $tax_class;
}
0
user1932595 2 years 2019-11-22T08:09:57-05:00 0 Answers 55 views 0

Leave an answer

Browse
Browse