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

Unable to change currency based on Shipping destination

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 tried using various codes provided on this forum but I am still unable to change currency based on the shipping country. My case is as follows -

If the user only enters the billing country, then the currency gets changed fine.

However, if the user enters both billing & shipping country, it still changes the currency based on the billing country.

Please help me fix this.

Hello

what code are you using? Please  drop me  this  code

Have tried using the codes provided here -

https://currency-switcher.com/possible-delivery-country-change-currency

https://pluginus.net/support/topic/autoupdate-the-currency-on-checkout-depending-the-shipping-country/

Hello

Great! Please drop me the specific code that you are using, the code that you have added to your file and do the test

and  drop  me  a  link to your site

Hi,

The codes provided in the links were the ones that we used but have removed them for now since it's a live site and we don't have a staging.

Site url - https://bit.ly/3bHU2SS

Hello

Ok! Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png and  wp-admin access - https://share.pluginus.net/image/i20210618130637.png

 

Hi,

Have done the same, please check & let us know.

Hello

Please  check  your access - https://c2n.me/4g5YN1Y.png

Try  to do a  test  with  this  code:

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;

if (is_string($data)) {
parse_str($data, $data);
}
//***
$country = $data['billing_country'];
if(isset($data['shipping_country']) AND $data['shipping_country']){
$country = $data['shipping_country'];
}
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);

Hi,

It works for the shipping country only now.

With this code, it doesn't work if the customer enters only the billing country and not the shipping country.

Also, have reset your user's password, please check now.

I have commented the shipping country part of the code for now so that the user doesn't face this issue.

 

Hello

Ok!  Try  this  code:

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;

if (is_string($data)) {
parse_str($data, $data);
}
//***
$country = $data['billing_country'];
if(isset($data['shipping_country']) AND isset($data['ship_to_different_address']) AND $data['ship_to_different_address']){
$country = $data['shipping_country'];
}
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);

 

Thanks for sharing, we are checking this at our end.

Welcome;)