How to modify Woocommerce progressive discounts?

Now a progressive discount from 30 000 rubles is 2% of 100 000 = 4% how to add a discount of 3% for payments from 60000 to 10000?
add_action('woocommerce_cart_calculate_fees','cart_price_progressive_discount'); 
cart_price_progressive_discount function() { 

 if (is_admin() && ! defined('DOING_AJAX')) 
 return; 

 $has_discount = false; 
 $stotal_ext = WC()->cart->subtotal_ex_tax; 

 // Percent Discount based on cart amount conditions 
 if($stotal_ext >= 30000 && $stotal_ext < 100000 ) { 
 $percent = -0.02; 
 $percent_text = ' 2%'; 
 $has_discount =true; 
 } elseif($stotal_ext >= 100000 ) { 
 $percent = -0.04; 
 $percent_text = ' 4%'; 
 $has_discount =true; 
 } 
 // Calculation 
 $discount = $stotal_ext * $percent; 

 // Displayed text 
 $discount_text = __('Your discount', 'woocommerce') . $percent_text; 

 if($has_discount) { 
 WC()->cart->add_fee($discount_text, $discount, false); 
 } 
 // Last argument in the add method fee on enable tax calculation if "true" 
}
April 7th 20 at 10:49
0 answer

Find more questions by tags WordPressWooCommerce