Tax being added to discounts
-
Hello,
I created a “Fixed basket discount” coupon with the hope of removing 5 pounds from order total if order is above 45 pounds. Unfortunately tax is calculated on this discount leading the discount to get as high as 60 pounds on some products for example. I understand this is because prices were set to be added exclusive of tax and this affects basket discounts too for some reason.
I also tried applying the discount programmatically as shown in the code below but no luck.
add_action( 'woocommerce_cart_calculate_fees', 'discount_based_on_total', 20, 1 ); function discount_based_on_total( $cart ) { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $total = $cart->cart_contents_total; if( $total > 45 ) $discount = 5; WC()->cart->add_fee( 'Discount', -$discount, false ); }
Is there a way out please?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Tax being added to discounts’ is closed to new replies.