Skip Navigation

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.

wcml_client_currency
wcml_client_currency_language

Solution:

Those cookies are created by wp-rocket plugin, see their document:

https://docs.wp-rocket.me/article/76-using-translation-multilingual-plugins

I don't think we can remove them from WPML side, you can check with wp-rocket support for it.

Relevant Documentation:

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by cookingwithdog 1 year, 9 months ago.

Assisted by: luo.

Author Posts
July 25, 2022 at 2:09 pm #11733573

cookingwithdog

Hello,

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.

wcml_client_currency
wcml_client_currency_language

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.

https://wpml.org/forums/topic/wcml_client_currency-cookie-error-502/
https://wpml.org/forums/topic/problem-with-wp-rocket-and-woocommerce-multilingual/

Woocommerce session and cart cookies are added only when you add a procuct in the cart.

Can you confirm when WCML set the currency cookies?

Thank you for your support.

July 27, 2022 at 7:15 am #11747387

luo

Hello,

WCML plugin won't setup cookies in other normal posts/pages by default, unless these:
1) the user changed the currency in currency switcher:
https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-shortcode
2) Add an item into cart

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

July 28, 2022 at 5:53 am #11755819

cookingwithdog

Hello,

As soon as WP Rocket is activated, these cookies are added to every page and post.

wcml_client_currency
wcml_client_currency_language

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.

WooCommerce
WooCommerce Multilingual & Multicurrency
WPML Multilingual CMS
WPML String Translation
WP Rocket

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.

Thank you.

July 28, 2022 at 6:46 am #11756031

luo

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

July 28, 2022 at 1:48 pm #11759991

cookingwithdog

I just activated the latest version of WP Rocket on the test site, and the top page shows the currency cookies. Please check the attached screenshot.

wcml_client_currency
wcml_client_currency_language

Thank you for providing me with the test site.

wcml_client_currency-cookies.jpg
July 29, 2022 at 6:47 am #11763503

luo

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

July 31, 2022 at 3:19 pm #11773419

cookingwithdog

I contacted the WP Rocket support and am waiting for their reply.

I will create a new ticket if anything comes up.

Thanks for pointing me in the right direction!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.