Woocommerce currency switcher by realmag777
Utilize the WooCommerce currency switcher plugin developed by realmag777.
add_filter('advanced_woo_discount_rules_converted_currency_value', function($price){
global $WOOCS;
if(isset($WOOCS)){
if (method_exists($WOOCS, 'get_currencies')){
$currencies = $WOOCS->get_currencies();
$convert_to_current_currency = false;
if(isset($WOOCS->is_geoip_manipulation) && $WOOCS->is_geoip_manipulation){
$convert_to_current_currency = true;
}
if(isset($WOOCS->is_multiple_allowed) && $WOOCS->is_multiple_allowed){
$convert_to_current_currency = true;
}
if(isset($WOOCS->woocs_is_fixed_enabled) && $WOOCS->woocs_is_fixed_enabled){
$convert_to_current_currency = true;
}
if($convert_to_current_currency === true){
if(isset($currencies[$WOOCS->current_currency]) && isset($currencies[$WOOCS->current_currency]['rate'])){
if($currencies[$WOOCS->current_currency]['rate'] != 0){
$price = $price * $currencies[$WOOCS->current_currency]['rate'];
}
}
}
}
}
return $price;
}, 10, 1);