This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with currency shifting and stock updates on their WooCommerce site when NitroPack caching is enabled. The currency selection is supposed to be based on the client's country, but it sometimes fails to change correctly. Additionally, product stock levels are not updating as expected. NitroPack support inquired about the use of variation cookies related to the WooCommerce Multilingual plugin, which the client could not find in the session.
Solution:
1) We confirmed that the necessary cookies for handling languages and currencies already exist, and one of them is a NitroPack cookie.
2) We invited NitroPack to collaborate with us through the Go Global Program to ensure compatibility between our plugins.
3) We provided a code snippet to create a custom cookie for currency:
4) We advised the client to add this code to their functions.php file and to ask NitroPack how to exclude the 'wcml_custom_currency_cookie' from caching.
If this solution does not seem relevant to your situation, please open a new support ticket with us.
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.
We have problem with currency shifting and stock updates on products.
The plugin we use is WooCommerce Multilingual/Multi-currency and for cache we use NitroPack. When we enable NitroPack this problem appears.
Choice of currency is done by client country. Sometimes is not changing correctly.
Also the product stock doesn't update sometimes.
I have been in contact with NitroPack support and they throw me this question that i don't have an answer for:
---
Can you please confirm if the plugin's configuration allows you to set/use variation cookies? If it allows, you can add the following variation cookies and hopefully this should solve the issue:
---
We were not able to completely understood the response from WPML Support. Do you need to create the 4 mentioned cookies by them ( wp-wpml_current_language; _icl_visitor_lang_js; _wcml_dashboard_currency; np_wc_currency) or you need to disable the additional creation of _wcml_dashboard_currency and np_wc_currency?
Sincerely,
Paul V.
Technical Support at NitroPack
---
Can you please specify what your plugin need to function properly?
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
You can please let them know that those cookies already exist and they are the ones that handle the languages and the currencies (one of them is even THEIR cookie!).
The reason why i have you those cookie names is so nitrpack could tell you if they could disable caching those cookies so they can change values and have multicurrency working.
Now it's starting to make sense. There are no cookie that tells what currency is selected. Do i need to add that programmatically?
Reply from NitroPack.
-------
Bobby (NitroPack)
Sep 10, 2021, 11:02 GMT+3
Hi, Anders,
I have sent the link for Go Global Program to our dev team.
As for the cookies we do not need to exclude them but we can add them on our side as variation cookies. That way we will create separate version of the page for every different value of those cookies.
I have checked the cookies on the website and can't see them:
[image uploded]
Those are all cookies without NitroPack, the website loaded from Sweden and the currency was changed to kr. I can't see which one is the one responsible for the currency change.
I have also added all those cookies as variation cookies just in case. Here are all cookies that are added as variation cookies at the moemnt:
[image uploded]
However, I'm now observing another strange behavior.
When visiting from Bulgaria I get prices in EUR and when I switch to Sweden the currency changes but not to kr but to British bound.
Could you please forward this to the WPML team and ask the to clarify which cookie am I missing.
Kind regards,
Bobby
Technical Support Engineer at NitroPack
--------
In NitroPack i can add "variation cookies". They causes them to create different cached version of the page depending of the content of that cookie.
I added your code, and added that cookie in NitroPack as a variation cookie and that seems to have solved the issue.
Thank you!
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.