|
Hi,
Welcome to WPML support.
First things first, please update WPML and WCML as new versions have better integration with cache systems:
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to "WordPress Dashboard > Plugins > Add new > Commercial (tab)".
- Click the "Check for Updates" button.
- Update WPML and its addons there.
For more information:
https://wpml.org/faq/install-wpml/#automated-updates
Check if the issue is fixed. If not, then follow the steps below.
As I am not sure which might take effect, I will list all.
1) Vary / don’t-cache the right cookies
Keep what you already added and include all WCML cookies WPML support recommends so each currency gets its own cache bucket:
wcml_client_currency
wcml_client_country
wcml_client_currency_language
wcml_client_currency_switched
In LSCache:
Cache → Cache → Vary Cookies: add wcml_client_currency (you can add the others too if your setup uses them).
Cache → Excludes → Do Not Cache Cookies: keep your WooCommerce session/cart cookies; add the WCML cookies above if you still see bleed-through.
We had something similar for Kinsta:
https://wpml.org/errata/woocommerce-multilingual-currency-switching-issue-with-kinsta-cache/
2) Store the currency in a cookie (not only WC session)
Force WCML to use a cookie so the cache can reliably key by it:
// Store selected currency in a cookie instead of WC session
add_filter( 'wcml_user_store_strategy', function () {
return 'cookie'; // default is 'wc-session'
} );
For more information:
https://wpml.org/wcml-hook/wcml_user_store_strategy/
3) Enable WCML’s “cache per currency” behavior
WCML has a switch that helps caches keep a distinct version per currency:
add_filter( 'wcml_is_cache_enabled_for_switching_currency', '__return_true' );
For more information:
https://wpml.org/forums/topic/multicurrency-switcher-issue-2/
4) Exclude the usual WooCommerce pages / endpoints from full-page cache
Even with per-currency variance, you should keep dynamic commerce endpoints un-cached:
URIs: /cart/, /checkout/, /my-account/
wc-ajax=… requests (LiteSpeed normally handles this, but verify)
WPML’s multicurrency + caching errata warns that caching can serve incorrect prices if dynamic bits are cached; excluding the commerce endpoints avoids that.
For more information:
https://wpml.org/errata/caching-plugins-may-cause-issues-with-wcml-multi-currency-settings/
Answers to your questions
Q1. Another WPML/WCML cookie to add?
Yes—besides wcml_client_currency, add wcml_client_country, wcml_client_currency_language, and wcml_client_currency_switched as needed.
Q2. Filters/hooks to ensure cookie storage?
Use wcml_user_store_strategy to return 'cookie' so the selection is always persisted in a cookie (cache-friendly). Optionally enable wcml_is_cache_enabled_for_switching_currency to allow per-currency cached pages.
Q3. LSCache exclusions specific to WCML?
Exclude dynamic WooCommerce endpoints from full-page cache and make sure the cache varies by wcml_client_currency (and related cookies).
Thanks.
|