Home›Support›English Support›[Resolved] Woocommerce Multilingual with Multi-Currency and WP Rocket Issue
[Resolved] Woocommerce Multilingual with Multi-Currency and WP Rocket Issue
This thread is resolved. Here is a description of the problem and solution.
Problem:
My site uses Woocommerce Multilingual (WCML) with multi-currency and WP Rocket. WCML sets the following 2 cookies when you visit a page or post, and WP Rocket will create different cache files according to each value.
My site uses Woocommerce Multilingual (WCML) with multi-currency and WP Rocket. WCML sets the following 2 cookies when you visit a page or post, and WP Rocket will create different cache files according to each value.
Does WCML set these cookies on every page and post in addition to product, cart, checkout and shop pages when you visit a site first time?
If so, this will reduce the chance to hit existing cache files. I don't want WCML to set the cookies when the visitors are just browsing blog pages that don't contain any shopping feature. Even if the preload feature creates cache files in advance, the visitor will not use the existing caches because of the currency cookies.
I think the following tickets are reporting this issue.
If it is a logged-in user, WordPress will setup the cookies, if the user changed the language in WPML language switcher, WPML plugin will setup the cookies.
And you can follow wp-rocket document to exclude specific cookies: hidden link
I tested it on my staging site with only the following plugins activated. The theme was switched to the default Twenty Twenty-Two, and all the plugins are the latest version.
I also turned off most of the WP Rocket features (javascript and CSS optimization, lazyload, mobile cache, etc) but it didn't fix the issue. As soon as WP Rocket is activated, wcml_client_currency and wcml_client_currency_language show up on every single page and post.
As you can see from this documentation, this issue creates different kind of cache files according to the cookie values for all the pages and posts that don't have Woocommerce features. This means preloaded existing cache files will not be used for the visitors with these cookies.
hidden link
Please test it with WooCommerce Multicurrency and WP Rocket activated and check if these cookies are added or not. If you can't reproduce the issue, please make a private reply available so that I can share the credentials to a test site.
Since it is a compatibility issue, and I don't have a copy of WP Rocket plugin in my localhost, please try to reproduce the same problem in below test site: hidden link
I need to test and debug it in a live website, thanks
Thanks for the details, I can see the problem in the test site, and but those cookies are created by wp-rocket plugin, see their document:
WooCommerce Multilingual
This is an add-on for WPML. WP Rocket uses dynamic and mandatory cookies to provide compatibility for the currency switcher and geolocation.
When the Geolocation option is active, this cookie: wcml_client_country must be set in the visitor's browser before caching will start.
Specific cache files will be created for each value of the following cookies:
wcml_client_currency
wcml_client_currency_language
wcml_client_country
Those cookies are generate by wp-rocket plugin, I don't think we can remove them from WPML side, you can check with wp-rocket support for it: hidden link