Skip Navigation

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 18 replies, has 3 voices.

Last updated by Alejandro 4 years, 11 months ago.

Assisted by: Alejandro.

Author Posts
June 16, 2020 at 6:29 pm #6386547

manuelB-6

Hi,

We have a problem with the WP Fastest Cache and WPML Multi-currency, if we have the cache activated, each time we move to a new page the curreny change to the default, not the second option selected.

We have texted adding this code to the functions, but the problem continues:

add_filter( ‘wcml_is_cache_enabled_for_switching_currency’, ‘__return_true’ );

Do you know how we can fix that?

We have tested other cache plugins and the problem is the same.

Thanks for your help.

June 17, 2020 at 11:23 am #6393391

manuelB-6

The problem continues yet, i would like to have assistance to solve it.

June 17, 2020 at 7:59 pm #6396807

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Please go to Plugins -> Add new -> Commercial -> Search for updates and make sure to install the latest versions of our plugins.

Then, if the issue persists, can you confirm that you get the same result when running the site only with WooCommerce, WPML and Cache plugins?

Also, if possible please test if the issue might be theme related.

Let me know about the results for further assistance.

Kind regards
Andreas

June 18, 2020 at 9:13 am #6401387

manuelB-6

Hi Andreas,

We have updated all, and tested disabling all the plugins less the Woo, WPML and Cache, and the problem continues.

We need your help.

Thanks.

June 18, 2020 at 5:40 pm #6406411

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

Please make a backup of site files and database before providing us access.
If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Kind regards
Andreas

June 18, 2020 at 10:22 pm #6407819

manuelB-6

Hi,

About duplicate the site with the plugin Duplicator, no problem, let me know if you need any info more.

Thanks for your help.

June 19, 2020 at 2:49 am #6408707

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

You are saying:

"each time we move to a new page the curreny change to the default, not the second option selected"

I see that ther eis not any default value set for each value currently. Do you wish to display EN to USD and ES to EUR?

Kind regards
Andreas

Capture.JPG
June 19, 2020 at 8:15 am #6410423

manuelB-6

Hello Andreas,

We would like the default currency for both languages to be the euro, but that when the user changes the currency, that currency will be kept while browsing the site while the cache is active.

Right now, if you go to a product you see the currency in euros. If you change to dollars, and you change category, product, or you go to the home page you will see everything in euros again, the change to dollars is not preserved.

Thanks for your help.

June 19, 2020 at 7:13 pm #6414535

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

But if it changes back on new page load to Euro I would say this is expected, as this is the determied default value.

Could you please try to enable language cookie for AJAX filtering at WPML -> Languages:

https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/

Maybe this could solve the issue.

Let me know.

Kind regards
Andreas

June 19, 2020 at 11:15 pm #6415453

manuelB-6

Hi Andreas,

No, it is not the expected way, in fact, if you are logged in as admin you can see how the site should work since the cache is not active for the logged in user. In that case you can go to home, put euro or dollar, the value you want, and browse the entire site and that value will be preserved throughout the site. If you change it, it will take the new value and you will be able to browse the entire site.

If you access as a non-logged in user, a normal user, and the website is in euros for example, and you change it to dollars, when you return to any url it will return to euros. Take the version that is cached (be it euro or dollar), it does not adapt to the value that the user has chosen.

On the variable that you comment on ajax, we already had it enabled and it still does not work correctly.

Any idea?

Thanks for your help.

June 20, 2020 at 2:34 am #6415929

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thanl you for your message.

So the issue occurs only for non-logged in users and is realted to the cache plugin, correct? So the issue does not occur if WP Fastest Cache is disabled?

Does it work after cleaning the cache? As far I can see this seem only to occur once.

As far I can see the currency stays the same for non-logged in users as long you stay on the store. I went to the store page, changed to USD, opened a product, browsed to another product, chose another product category and it always stayed on USD.

Then I went to a different page and came back to the store and the currency switched to EUR, so I started from the beginning and suddenlty the currency stayed all time on USD.

Even when switching to Prensa and then back to store it stayed on USD. I tested now for about 5 minutes and the issue occured once and that not longer

This seems to be cache related and occurs after first page load which means the cache plugin takes a while to store the language realted data.

Can you confirm that?

I can consult our second tier about that but take note that if this is related to the cache plugin then there mightnot be much we could do about it.

Kind regards
Andreas

June 20, 2020 at 8:41 am #6417083

manuelB-6

Hi Andreas,

Yes, the problem appears when the cache is working, with users not logged in.

When the cache is cleared, the first load of each page cached, is the one that will remain, and is the one that will change continuously, be it euros or dollars, that's the problem.

In your case, the change to dollars was kept because you had just cleaned the cache safely and there was nothing in the cache, it was the first thing that was cached, so that is the copy that it maintains. If once you browsed the site in dollars, you change the currency in a product to euros, and you try to do the same navigation you will see that it changes you to dollars, because it is what it has in cache, it does not respect the new choice of euros.

The problem seems to be caching relative to multi-currency. The Fastest Cache is one of the best plugins, but tell me that another plugin we can use in combination with WPML and that it is tested with multicurrency, and if there is any special configuration to make it work, since we have tried several and it gives us the same problem.

A cache system is very important in stores like this to make a better user experience.

Thanks for your help.

June 20, 2020 at 9:31 pm #6418679

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I did not log in to your site so far, I neither cleared the cache.

I have been navigating on the Spanish site between shop, product pages, product categories, blog and other pages and switched the currency from time to time.

I did not at any moment lose my current currency settings.

It seems to me this issue is kind of difficult to recreate and it seems to be a random issue, which is cache related, is this correct?

Now, here some examples of steps I took, without an issue:

1) Going to hidden link
2) Default currency EUR appears as expected.
3) Switch currency to USD.
4) Open a product from homepage, currency stays on USD.
5) Use menu to go to any product category, currency stazs on USD.

6) Switch currency to EUR.
7) Open a random product from current category, switcher stays on EUR.
8) Switch to a random product category, switcher stays on EUR.
9) Open random product, switcher stays on EUR.

10) Switch currency to USD.
11) Leave store page and go to Prensa, then get back to Homepage, currency stays on USD.
12) Open a random product category from Menu, switcher stays on USD.
13) Open a random product, switcher stays on USD.

I then did an identical test while using the English site:

14) While on product, switching from Spanish to English, currency switches to EUR, which is expected, as it is assigned as default currency, correct?

15) Starting from the top. Same result.

Please provide me detailed steps in order to be able to reproduce the issue.

Kind regards
Andreas

June 22, 2020 at 8:40 am #6424143

manuelB-6

Hi Andreas,

Please do these steps:

1) Enter in Chrome
2) Clean browser cache

3) Go to hidden link
4) Go to hidden link
5) Go to hidden link
6) Go back to home page: hidden link

7) Until here you saw the euro currency. Now, please change the currency to dollars.

8) Go to hidden link ¿What currency do you see? If euros, here you have the issue.
9) Go to hidden link ¿What currency do you see?
10) Go back to home page: hidden link ¿What currency do you see?

Do you saw the problem?

Thanks for your help.

Regards.

June 23, 2020 at 12:14 pm #6434573

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hi/Ciao!

I'm taking over this ticket because Andreas is currently not available.

I believe here the problem is actually with the cookie that WooCommerce Multilingual creates. this is the behaviour i noticed that made me believe this:

- I changed the currency and visited a page that was PRELOADED by fastest cache
- The currecny changed to the original one that was cached before
- went back to the page where i set the currency and now the currency was there set correctly
- Returned to the previous product and the problem reappeared.
- i set the currency to the one i wanted and visited another product.
- in the new product, things are not correct but if i return to the previous problem, the correct currency was set.

This is a clear behavior of 2 things:

1) There's a cookie that is set to actually store the client's preference
2) The cache plugin is only rewriting the cookie once the page is "flushed" (which happens when you set a new cookie or trigger an event) because otherwise it would show the cached version of the page with the cached settings

This is not really a bug, it's how cache works but fastest cache actually makes it pretty easy to fix this.

You just need to check the site's JS inspector (f12 or right click > Inspect), then head to "network" and click the root page (the page where we are located at the moment, be it a product page or the homepage, etc)

Then, find the section "requests headers" and find "cookie".

in that section you'll find all the cookies set in that page and one of them is "_wcml_dashboard_currency" which stores the desired selected currency.

with that info you can create an exclusion in fastest cache where you select to exclude the _wcml_dashboard_currency cookie and that should do it.

I did that for you as you can see in the screenshot below, and it seems that did it. you can do that for pretty much evry cookie that is not working as you want it to work.

Try it out and let me know if that works for you or if there's something else that maybe i didn't get from this conversation.

Regards.

exclude cookie.jpg