PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Delivery country change

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi, I would like to have the delivery country change the currency and i have checked out your code here https://currency-switcher.com/possible-delivery-country-change-currency/ . But i need to add another condition that if the currency is CNY or WON then force it to SGD.

I have tried the following codes but the"if CNY or WON force to SGD" (highlighted in bold below) condition is not working. Could you please help to take a look? Thanks.

My Currency backend setting - Is Multiple Allowed (YES), GeoIP rules is on (CNY -> China, WON -> Korea, GBP -> UK, etc.), Checkout by Geo IP rules (NO),

How do i give you access to my backend? I don't think i can post it here.

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;
if (is_string($data)) {
parse_str($data, $data);
}
//***
$_currency = $WOOCS->get_currency_by_country($data['billing_country']);
$currt_currency = $WOOCS->current_currency;
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
if ($currt_currency =="CNY") {
$WOOCS->set_currency('SGD');
}
if ($currt_currency =="WON") {
$WOOCS->set_currency('SGD');
}

}, 9999);

Hello

Try  this please:

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;
if (is_string($data)) {
parse_str($data, $data);
}
//***

$_currency = $WOOCS->get_currency_by_country($data['billing_country']);
$currt_currency = $WOOCS->current_currency;

if ($currt_currency =="CNY" OR $currt_currency =="WON") {
$WOOCS->set_currency('SGD');

return false;
}

if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}

}, 9999);

If  no luck - You should hire a developer.

Hi, thanks for the code but it doesn't work.

I have found a solution. The code below is working.

$current_country= sanitize_text_field($_REQUEST['country']);
if($current_country=="CN" OR $current_country=="KR"){ $WOOCS->set_currency("SGD"); }

Hello

 

Great!  This is a good idea.