Unable to set currency with ship to different address code
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 pleaseIf 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.
Quote from Vaibhav on October 29, 2021, 07:25Hi,
The issue I am facing is as follows -
If I use the below code only, then the currency is changing correctly based on the billing address:
add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;if (is_string($data)) {
parse_str($data, $data);
}$country = $data['billing_country'];
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);
However, since I have to change the currency if someone opts to change their shipping country, then I am using the below code as suggested by you to someone else in another topic on this forum -
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'] 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);
With this code, it is changing according to shipping country only whereas I would want it both ways. Please help.
Site link - https://bit.ly/3EqrGpl
2 currencies are used on this site - INR for India and USD for everywhere else
Hi,
The issue I am facing is as follows -
If I use the below code only, then the currency is changing correctly based on the billing address:
add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;
if (is_string($data)) {
parse_str($data, $data);
}
$country = $data['billing_country'];
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);
However, since I have to change the currency if someone opts to change their shipping country, then I am using the below code as suggested by you to someone else in another topic on this forum -
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'] 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);
With this code, it is changing according to shipping country only whereas I would want it both ways. Please help.
Site link - https://bit.ly/3EqrGpl
2 currencies are used on this site - INR for India and USD for everywhere else
Quote from Pablo Borysenco on October 29, 2021, 10:50Hello
Please delete this code - https://share.pluginus.net/image/i20211029115041.png - and do a test
Hello
Please delete this code - https://share.pluginus.net/image/i20211029115041.png - and do a test
Quote from Vaibhav on November 30, 2021, 11:52Hi Pablo,
Thank you for your response earlier.
Sorry I could not respond as I got unwell for quite sometime now.
I am back at work now. I checked by removing this code. The situation remained the same.
Please guide how can we fix it now?
Hi Pablo,
Thank you for your response earlier.
Sorry I could not respond as I got unwell for quite sometime now.
I am back at work now. I checked by removing this code. The situation remained the same.
Please guide how can we fix it now?
Quote from Pablo Borysenco on November 30, 2021, 12:51Hello
Please drop me exact link to the issue
Hello
Please drop me exact link to the issue
Quote from Vaibhav on November 30, 2021, 14:32Site link - https://bit.ly/3EqrGpl
Site link - https://bit.ly/3EqrGpl
Quote from Vaibhav on December 1, 2021, 10:42Hi,
Did you check?
I have currently kept this code in the comments so that the users are not affected -
if(isset($data['shipping_country']) AND $data['shipping_country']){
$country = $data['shipping_country'];
}
Hi,
Did you check?
I have currently kept this code in the comments so that the users are not affected -
if(isset($data['shipping_country']) AND $data['shipping_country']){
$country = $data['shipping_country'];
}
Quote from Pablo Borysenco on December 1, 2021, 11:48Hello
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
Hello
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
Quote from Vaibhav on December 2, 2021, 09:12Hi,
We are currently on a free version and facing these issues.
Hi,
We are currently on a free version and facing these issues.
Quote from Pablo Borysenco on December 2, 2021, 11:52Hello
We are currently on a free version and facing these issues. - This is not true. I see that you are using the paid version of the plugin.
And this is not a plugin problem, this is a custom code problem that you inserted.
Hello
We are currently on a free version and facing these issues. - This is not true. I see that you are using the paid version of the plugin.
And this is not a plugin problem, this is a custom code problem that you inserted.
Quote from Vaibhav on December 9, 2021, 12:29Hi,
The custom code was provided by you to someone in this forum only. Also, you had asked me to remove that line of code to check. Request you to please see our initial conversation regarding this in this thread and help me.
Hi,
The custom code was provided by you to someone in this forum only. Also, you had asked me to remove that line of code to check. Request you to please see our initial conversation regarding this in this thread and help me.
Quote from Pablo Borysenco on December 9, 2021, 13:09Hello
Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png
Hello
Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png