Compatible for Aelia Currency Switcher for WooCommerce
Compatibility with Aelia Currency Switcher for WooCommerce.
add_filter('advanced_woo_discount_rules_converted_currency_value', function($price){
if(is_numeric($price) && !empty($price)) {
// Get the source currency. We assume that it's always shop's base currency
$from_currency = get_option('woocommerce_currency');
// Pass the price to the currency conversion filter provided by the Currency Switcher. This
// will ensure that the discount is converted correctly
$price = apply_filters('wc_aelia_cs_convert', $price, $from_currency, get_woocommerce_currency(), 5);
//for not rounding the price which affects subtotal based condition with .01 difference in some cases
if(function_exists('bcdiv')){
$price = bcdiv($price, 1, 2);
}
}
return $price;
}, 10);