round off issue for subtotal promotion message
Address rounding issues when displaying promotion messages related to subtotal amounts.
add_filter('advanced_woo_discount_rules_discount_prices_of_product', function ($discount_prices, $product, $quantity, $cart_item){
//FOR CHANGING DISCOUNTED_PRICE you can change it in $discount_prices['discounted_price']
if(isset($discount_prices['discounted_price'])){
//$discount_prices['discounted_price'] = wc_round_discount($discount_prices['discounted_price'], 0);
$discount_prices['discounted_price'] = number_format($discount_prices['discounted_price'], 2, '.', '');
}
if(isset($discount_prices['discount_lines'])){
foreach ($discount_prices['discount_lines'] as $key => $value){
if($key !== 'non_applied'){
$line_discount = $discount_prices['discount_lines'][$key]['discounted_price'];
//$discount_prices['discount_lines'][$key]['discounted_price'] = wc_round_discount($line_discount, 0);
$discount_prices['discount_lines'][$key]['discounted_price'] = number_format($line_discount, 2, '.', '');
}
}
}
return $discount_prices;
}, 10, 4);PreviousReload cart page after update cart totalNextDelete Extra Plugin Tables When a Site Is Deleted in WordPress Multisite
Last updated