Home How do I apply Cart Discount Before Tax in woocommerce
Reply: 0

How do I apply Cart Discount Before Tax in woocommerce

user849
1#
user849 Published in May 23, 2018, 8:29 pm

I have being trying to apply cart discount before tax usgin my custom Woocommerce Plugin. But it is not getting applied using the action hook woocommerce_cart_discounts_before_tax in my custom plugin file.

Here is the code from my custom plugin file.

public function custom_discount(){
                global $woocommerce;
                $abc = woocommerce_price(5);
                echo $abc;
}

and the action hook

if(!empty($_POST['apply_discount_woo'])){
                    add_action( 'woocommerce_cart_discounts_before_tax', array(&$this,'custom_discount'));
                }

I get the following screen

The screenshot shows $5 above the subtotal but doesn't get applied to the cart and shows the wrong total.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33948 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO