Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/6be6a840094bb861e60e4729bfc910d1 to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/6be6a840094bb861e60e4729bfc910d1 to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - variable product round up two decimal places
add_filter('advanced_woo_discount_rules_format_sale_price_range', function( $html, $min_price, $max_price){
$min_price = number_format((float)$min_price, 2);
$max_price = number_format((float)$max_price, 2);
if (function_exists('wc_format_price_range')) {
$html = wc_format_price_range($min_price, $max_price);
} else{
if(class_exists('\Wdr\App\Helpers\Woocommerce')){
$html = \Wdr\App\Helpers\Woocommerce::formatPrice($min_price) . ' - ' . \Wdr\App\Helpers\Woocommerce::formatPrice($max_price);
}
}
return $html;
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment