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

Autoupdate the currency on checkout depending the shipping country

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.

Hello,
I try to autoupdate the currency on the checkout page depending on the billing address, or the shipping address if the user check the"Ship to a different address".
I try with your code https://pluginus.net/support/topic/how-can-i-change-currency-in-cart/ but this one don't update the currency when have a shipping address.
Also, try this ones https://pluginus.net/support/topic/checkout-billing-and-shipping/ but don't refresh the changes, I need to refresh the page to see the new currency.
Some idea about how to make this works?
Thank you in advance.-

Hello

Please  drop  me  exact  link to  the  issue

Hello Pablo, thank you for your update.
I'm working on a local environment for now.
I can check locally your solution and share the feedback?
Thank you in advance.-

Hello Pablo, some additional information.

ONLY BILLING ADDRESS:
I try your snippet https://pluginus.net/support/topic/how-can-i-change-currency-in-cart/
Works only with a billing address/country.
And don't update the currency with a shipping address/country.

SHIPPING ADDRESS:
I try your last snippet from https://pluginus.net/support/topic/checkout-billing-and-shipping/
Works only with a shipping address/country.
And looks like don't return the right billing currency if I uncheck the"ship to a different address".

Some help to:
- Update the billing currency when only have a billing address,
- Update the shipping currency when use shipping address,
- Back to the billing currency when uncheck the"ship to a different address",

I try to do this work because this is the new law in Europe.
Sales should be in the currency where ship the products.

Thank you in advance.-

Hello

What plugin version number are you using?

Try  to use  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  !wc_ship_to_billing_address_only()){
$country = $data['shipping_country'];
}
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);