PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

FOX Currency fails to change with language switch using PolyLang

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 please
If 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.

Hi, I'm using your plugin and according to your code instructions to switch currency once language changes on my website hillyashop.com

I'm using the following code:

add_filter('wp_head', function() {
$lang = get_locale();
global $WOOCS;
switch ($lang)
{
case 'he-IL':
$WOOCS->set_currency('ILS');
break;
case 'en-US':
$WOOCS->set_currency('USD');
break;
default:
$WOOCS->set_currency('USD');
break;
}
});

 

But currency stays at USD instead of ILS even when I switch language to Hebrew.

What causing this?

 

Hello

You may be using the wrong language code.

Try to use this code to check what the function  get_locale(); returns

add_filter('wp_head', function() {
$lang = get_locale();
var_dump($lang );
});

Language codes must match even in case

Yes you were correct @pavlo_borysenco , the correct way to write the language is like this:

"en_US"

But now I did changed that, and Hebrew language shows the ILS for few seconds and changes back to USD.

https://hillyashop.com/he/%d7%93%d7%a3-%d7%94%d7%91%d7%99%d7%aa/

Also adding product to cart shows back the price in USD, the sync with woocommerce seems to have bugs.

Hello

Where did you paste this custom code?

Please  drop me  screenshots  of  the FOX settings

@pavlo_borysenco I used this custom code in functions.php file.

 

Screenshot:

 

https://snipboard.io/nYEBkr.jpg

Hello

Looks like your custom code doesn't work in ajax mode(I think the language is defined incorrectly).

try adding this code(https://share.pluginus.net/image/i20230516112225.png):

if (wp_doing_ajax()) {

return;

}