Help adding discount (tax issue)
-
Hi,
I am adding a discount to the order when a specific checkbox is checked by the customer. I need this discount to be a fixed price, regardless of the tax rate, ie. a customer from a country with 20% tax rate should receive the same discount ($5) as someone from a country with 10% tax rate.I have this code
// Set the discount add_action( 'woocommerce_cart_calculate_fees', 'checkout_set_discount', 20, 1 ); function checkout_set_discount( $cart ) { if ( ( is_admin() && ! defined('DOING_AJAX') ) ) return; $discount = 5; if( WC()->session->get('priority_fee') ) { $cart->add_fee( sprintf( __( 'Discount', 'woocommerce') ), -$discount ); }
but this results in the discount being 5.50 for a country with 10% tax rate, 6 for a country with 20% tax rate and so on…how can I make the tax a fixed 5$?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Help adding discount (tax issue)’ is closed to new replies.