#StackBounty: #wordpress #woocommerce Apply woocommerce coupon only to the cart total, not to the tax line

Bounty: 50

I am working on woocommerce site.In which on checkout page while I apply coupon it is automatically apply to tax as well.

I want to apply coupon code to cart total only. I have tried google for related hook and plugin but can not find solution.

My hook in function.php file, not working,

add_action('woocommerce_product_tax_class', 'set_tax_class');
function set_tax_class () { 
    if (!empty($woocommerce->cart->applied_coupons)){
        $tax_class = 'gratuty';
    return $tax_class;

I have tried woocommerce_cart_calculate_fees hook too, but it did not work.

Which hook should I use to update cart when coupon is applied, without changing the tax?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.