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

Currency on translation - but can't switch currency

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.

Dear team,

We have incorporated the auto currency selection by putting in the following code:
But we can't seem to switch the currency anymore. Please see website: https://www.handshoemouse.store/

Any way to fix this?

add_filter('wp_head', function() {
$lang = weglot_get_current_language ();
global $WOOCS;
switch ($lang)
{
case 'nl':
$WOOCS->set_currency('EUR');
break;
case 'en':
$WOOCS->set_currency('USD');
break;
default:
$WOOCS->set_currency('USD');
break;
}
});

Hello

Paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png

Are you sure that this function  weglot_get_current_language () will return such a language code.  Check if this code - 'en_GB'

Where did you put this code?

Hi Pablo,

Ive just pasted the license key.

The function is actually already working, I put it in functions.php before. (but removed it for now)
The only problem is, that i cant switch currency, after Ive switched language.

Cheers,

Hello

Yes, this is correct behavior. This code removes the ability to change the currency using the switcher.  This is the meaning of this code: switch currency depending on the current language

Hi Pablo,

Thanks for your reply.

Is it possible to switch currency depending on current language, but also let the user switch afterwards?

This would be great, because people that visit the website in english dont always pay with $ and vica versa.

Cheers,

Colin

Unfortunately your custom code cannot provide this behavior.