Fixed currency based on user sign up icm Terra Wallet
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 Rubrix on August 10, 2022, 14:28Hi,
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!
Quote from Pablo Borysenco on August 11, 2022, 11:37Hello
I can suggest you next algorithm to update currencies immediately:
- after updating of billing country should be work hook which updates currency by:
$_currency = $WOOCS->get_currency_by_country($data['billing_country']);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}- if billing address updating is custom should be ajax request to server which make currency updating by your code above
- try please hook: woocommerce_update_customer -> https://wp-kama.com/plugin/woocommerce/hook/woocommerce_update_customer
- or maybe this hook: profile_update -> https://developer.wordpress.org/reference/hooks/profile_update/
Try please, and give us know how is it works ...
Hello
I can suggest you next algorithm to update currencies immediately:
- after updating of billing country should be work hook which updates currency by:
$_currency = $WOOCS->get_currency_by_country($data['billing_country']);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
} - if billing address updating is custom should be ajax request to server which make currency updating by your code above
- try please hook: woocommerce_update_customer -> https://wp-kama.com/plugin/woocommerce/hook/woocommerce_update_customer
- or maybe this hook: profile_update -> https://developer.wordpress.org/reference/hooks/profile_update/
Try please, and give us know how is it works ...
Quote from Rubrix on August 11, 2022, 16:22Hi Pablo,
Thanks for your answer. For some reason the woocommerce_update_customer hook works great for changing the wallet currency. It changes immediately after saving the user account. But the WooCommerce prices in the cart and on the shop page don't change. They only change after I visit the checkout page.
So we are halfway there.
Thanks in advance!
Hi Pablo,
Thanks for your answer. For some reason the woocommerce_update_customer hook works great for changing the wallet currency. It changes immediately after saving the user account. But the WooCommerce prices in the cart and on the shop page don't change. They only change after I visit the checkout page.
So we are halfway there.
Thanks in advance!
Quote from Pablo Borysenco on August 15, 2022, 10:03Hello
Because this hook only works on the checkout page
You should use a hook that works on all pages.
an example - wp_head - Check the current user and his billing_country
Hello
Because this hook only works on the checkout page
You should use a hook that works on all pages.
an example - wp_head - Check the current user and his billing_country