Quote from ALEXHOJER on July 29, 2020, 13:18
Hello
I am struggling with this a bit.
When in check out, I want the billing address to override the IP/geo, and if "deliver to a different address" the shipping address to override the billing address.
But if the "deliver to a different address" has been filled in but is unchecked, it still sets the currency.
If unchecked it needs to revert back to Billing address currency.
Does this make sense?
I am a complete beginner, this is my first site so please could you give me exact code instructions to copy and paste..?
Currently, as per your instructions I have used this code in the child theme's function.php
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']);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);
Thank you for your help!
Alex
Hello
I am struggling with this a bit.
When in check out, I want the billing address to override the IP/geo, and if "deliver to a different address" the shipping address to override the billing address.
But if the"deliver to a different address" has been filled in but is unchecked, it still sets the currency.
If unchecked it needs to revert back to Billing address currency.
Does this make sense?
I am a complete beginner, this is my first site so please could you give me exact code instructions to copy and paste..?
Currently, as per your instructions I have used this code in the child theme's function.php
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']);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);
Thank you for your help!
Alex