
svetlana123(@svetlana123)
17 Posts
Customers
Quote from svetlana123 on July 4, 2022, 20:36
Hello Pablo,
Can you please, help to fix a couple moments on https://www.shop.handmadehome.me/
- A small issue with mini cart currency. When cart is empty main currency permanently displayed:

If I add a product to the cart, the currency will be changed and displayed correctly. So the issue only appears when cart is empty:

2. The second issue with currency by WPML language. I want to set RUB for Russian language.
I added your code from https://currency-switcher.com/switch-currency-with-language-change, but it doesn't work.
add_filter('wp_head', function() {
$lang = ICL_LANGUAGE_CODE;
global $WOOCS;
switch ($lang)
{
case 'ru':
$WOOCS->set_currency('RUB');
break;
default:
$WOOCS->set_currency('USD');
break;
}
});

Just in case you're wondering why it worked for the first case, I also have GeoIp rules:

So if I use non-russian ip and switch to Russian language I see USD instead RUB
(Language switcher at very bottom of website)
Thank you!
Hello Pablo,
Can you please, help to fix a couple moments on https://www.shop.handmadehome.me/
- A small issue with mini cart currency. When cart is empty main currency permanently displayed:

If I add a product to the cart, the currency will be changed and displayed correctly. So the issue only appears when cart is empty:

2. The second issue with currency by WPML language. I want to set RUB for Russian language.
I added your code from https://currency-switcher.com/switch-currency-with-language-change, but it doesn't work.
add_filter('wp_head', function() {
$lang = ICL_LANGUAGE_CODE;
global $WOOCS;
switch ($lang)
{
case 'ru':
$WOOCS->set_currency('RUB');
break;
default:
$WOOCS->set_currency('USD');
break;
}
});

Just in case you're wondering why it worked for the first case, I also have GeoIp rules:

So if I use non-russian ip and switch to Russian language I see USD instead RUB
(Language switcher at very bottom of website)
Thank you!

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on July 5, 2022, 10:53
Hello
- Yes, when there are no products in the cart to save resources, the cart is not redrawn
- I did a test. I switch the language, the currency switches too.
Hello
- Yes, when there are no products in the cart to save resources, the cart is not redrawn
- I did a test. I switch the language, the currency switches too.

svetlana123(@svetlana123)
17 PostsTopic Author
Customers
Quote from svetlana123 on July 5, 2022, 11:16
Oops truly works:) I'm sorry, that should be a cache plugin.
Can I ask which rule dominates: currency by language or currency by GeoIp?
For example, if I set USD for US in GeoIp and RUB for Russian language. If visitor from US switch into Russian language what currency would be displayed?
And is this a good idea to create such rules?
Thank you!
Oops truly works:) I'm sorry, that should be a cache plugin.
Can I ask which rule dominates: currency by language or currency by GeoIp?
For example, if I set USD for US in GeoIp and RUB for Russian language. If visitor from US switch into Russian language what currency would be displayed?
And is this a good idea to create such rules?
Thank you!

svetlana123(@svetlana123)
17 PostsTopic Author
Customers
Quote from svetlana123 on July 5, 2022, 11:40
The thing that I also have GeoIp rule Russia=RUB. But looks like currency only depends on language, GeoIp rule doesn't count..? I expected that visitors from Russia see RUB in any case (GeoIP) and other visitors see currency depending on language.(Russian=RUB, English=USD)
The thing that I also have GeoIp rule Russia=RUB. But looks like currency only depends on language, GeoIp rule doesn't count..? I expected that visitors from Russia see RUB in any case (GeoIP) and other visitors see currency depending on language.(Russian=RUB, English=USD)

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on July 5, 2022, 12:30
your custom code is what switches the currency. Other rules with this code do not work
your custom code is what switches the currency. Other rules with this code do not work

svetlana123(@svetlana123)
17 PostsTopic Author
Customers
Quote from svetlana123 on July 5, 2022, 14:58
Thank you so much!
Thank you so much!

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on July 6, 2022, 12:15
Welcome;)
Welcome;)