Currency Switcher not working?
-
Is the currency switcher working on the latest version of Woocommerce? We’ve just noticed that changing the currency doesn’t do anything, just reloads the page with it remaining in the current currency.
Any known issues?
-
Hi @delanthear,
I wasn’t able reproduce the issue on a clean install. Here’s a quick recording showing the currency switcher working as expected: https://www.loom.com/share/654d1eec75fd44498efb2836ce5d6d88
Could you please try in a minimal environment to detect if the issue is related to a third party plugin or theme? On a staging copy of your site:
- Clear all caches
- Deactivate all plugins but WooCommerce and WPML Multilingual & Multicurrency for WooCommerce + switch to a default theme like 2025.
- If the issue disappears, start by reactivating your theme and check again
- Then reactivate all the plugins one by one (or in small groups) and check every time if the issue reappears. This way you will be able to identify the plugin that is causing the issue.
You can also enable WP_DEBUG to see if you have any PHP errors.
Please let us know what you find.
Ok, the issue is because we’ve a code snippet running:
add_filter('wcml_client_currency', function($currency) {
// Show USD only when viewing this category archive
if (is_product_category('worldwide-items')) {
return 'USD';
}
// Everywhere else keep Rand
return 'ZAR';
});If I turn this off, it does work now. This code was put in so that if people browsed the products on a specific category page, it showed the prices in $ instead of the default of Rand.
Weirdly, even though I’ve turned this off, the currency switcher no longer shows at all. Does it cache out something which stops it displaying?
Fixed the code by
return $currency;so it doesn’t break the change!
I’m definitely having trouble with the switcher unreliably appearing though. I can’t work out why it sometimes appears and sometimes doesn’t.
Your snippet will force USD for the product on that particular category archive page and ZAR anywhere else (other categories/archive, store, and on individual product pages). That’s why the switcher doesn’t have any effect here.
If you want to show the price in a specific currency for that category but let the client the ability to change currency you could try:
add_filter('wcml_client_currency', function($currency) {
// Show USD only when viewing this category archive
if (is_product_category('worldwide-items')) {
return 'USD';
} // Everywhere else keep the current currency
return $currency;
} );-
This reply was modified 1 day, 10 hours ago by
Nicolas V..
So, now with $currency the clients can use the currency switcher right?
What do you mean by “the switcher unreliably appearing”? Does the switcher appears on some products and not others? Maybe you have the “Show only products with custom prices in secondary currencies” option activated?
I’m not sure if it’s another plugin interaction as I can’t really work out when/why it happens. Basically sometimes I go into the product page and the switcher isn’t there.
I think it’s a plugin clash issue tbh!
Could you please share an url where I can see the issue?
https://theonipapoutsis.co.za/product/holistic-empowered-postpartum-bundle/
On one of my browsers the switcher shows, on the other it doesn’t!I can see the currency switcher. I tried on Mac (Chrome + Safari) and Windows (Chrome + Edge + Firefox). It could be a cache issue.
You must be logged in to reply to this topic.