Quote from Rubrix on August 10, 2022, 14:28
Hi,
I am using WOOCS plugin in combination with Terra Wallet. The situation is that I run a private webshop that is only available to logged in users.
When a user signs up for the website, they already choose their country which will be stored als 'billing_country' in their user meta.
When a user signs up, I want to show immediately the prices and also the wallet amount based on the country they signed up with. No matter where there IP comes from.
I already used following snippet to achieve this on the checkout page:
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);
The only problem is that when a users changes his/hers billing_country in their account, the currencies showing in the wallet and the shop page, are only update after the checkout page is visited.
Is there a way to just always fix the currency based on the billing_country form the moment the users signs up, and I can only change when the edit their own account page.
Thanks in advance!
Hi,
I am using WOOCS plugin in combination with Terra Wallet. The situation is that I run a private webshop that is only available to logged in users.
When a user signs up for the website, they already choose their country which will be stored als 'billing_country' in their user meta.
When a user signs up, I want to show immediately the prices and also the wallet amount based on the country they signed up with. No matter where there IP comes from.
I already used following snippet to achieve this on the checkout page:
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);
The only problem is that when a users changes his/hers billing_country in their account, the currencies showing in the wallet and the shop page, are only update after the checkout page is visited.
Is there a way to just always fix the currency based on the billing_country form the moment the users signs up, and I can only change when the edit their own account page.
Thanks in advance!