This thread is resolved. Here is a description of the problem and solution.
Problem:
The client reported that when they are on a product page and change the currency, the currency does not update unless they navigate to a different product or category page.
Solution:
We suggested a workaround involving either WP Rocket settings or a code snippet:
1. Navigate to Settings > WP Rocket.
2. Go to Advanced rules > Never Cache Cookies.
3. Add the cookie
wcml_client_currency
.
Alternatively:
1. Empty your cache first.
2. Open your theme's functions.php file.
3. Insert the following code:
/*<br />compsupp-7372<br />This filter adds ?wcmlc={currency_code} to the URL, which specifies a query string with the currency code.<br />*/<br />add_filter('wcml_is_cache_enabled_for_switching_currency', '__return_true');
The client only needs to try one of these solutions, not both.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
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.
Tagged: Account Issues, WCML
Related documentation:
Author | Posts |
---|---|
April 29, 2024 at 9:56 am #15576254 | |
vibekeO |
When I'm on a product and I've changed currency, the currency on the product does not change. I need to update o a diffetent product or category for the currency to change.. How can we fix this? |
April 29, 2024 at 11:01 pm #15578938 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
Hi there, What are your results when deactivating Object Cache Pro ? The issue looks like it could be caused due to some caching or ajax issue. |
April 30, 2024 at 6:37 am #15579386 | |
vibekeO |
hi, I tired to disable both Object Cache, and also Fibosearch but it did not help.. I still need to change URL (product or page) for the currency to change on the product. Is that normal? I need the currency to change on the same page.. |
April 30, 2024 at 5:50 pm #15582387 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
I would like to request temporary access (wp-admin and FTP) to your site to test the issue. **Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken ** I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/ NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin. Thank you, |
May 1, 2024 at 6:18 pm #15584785 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
Thanks for providing the access details. I encountered an issue with the SFTP connection. When attempting to use the Duplicator plugin to create a copy for testing in a minimal environment, it caused a redirect loop, requiring manual deactivation. Please navigate to your file manager, go to wp-content/plugins/duplicator, and add .deactivate to the folder name? This will remove the plugin. |
May 2, 2024 at 7:49 am #15585838 | |
vibekeO |
I have removed the plugin. |
May 2, 2024 at 8:56 pm #15589171 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
Thank you, I was able to deploy a copy using the all in one plugin already installed on your site. The currency switch is working OK in the local environment, please see the following screencast hidden link There 2 major differences between the 2 environments: #1 These 2 plugins are deactivated: advanced-cache.php object-cache.php #2 PHP version is 7.4.21 instead of 8.0 Other than that, all settings and configurations are the same. |
May 3, 2024 at 6:27 am #15589532 | |
vibekeO |
Hi, The cache is something I really can't change.. We need cache on the site for it to have some speed. But do you think it may be PHP? |
May 3, 2024 at 6:40 am #15589558 | |
vibekeO |
I also see that it works fine on product category, just not a single product.. |
May 3, 2024 at 6:41 am #15589560 | |
vibekeO |
Can that be connected with the fact that we use a builder for the product page, and not straigh out of Woocommerce? PS: Sorry for all the short messages. |
May 3, 2024 at 11:10 am #15591132 | |
vibekeO |
It is quite clear now that the currency swicher does not work wit hDivi when we use the Divi builder on the product or product pages. |
May 4, 2024 at 1:38 am #15593048 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
Thank you for the updates! I am testing this based on your findings with the divi builder being used on the product and will update you. Do I have your permission to add a new test product to test this on your site, as I have not been able to reproduce on a local environment. Also, if possible I would like to install the plugin cloudways migration to take a copy of your site and move onto our staging environment where we both will have access to showcase any of our findings. |
May 6, 2024 at 8:05 am #15595729 | |
vibekeO |
Hi, yes you can add a new test product, don't give it any SKU please. And please use this as we have a connection with an API, and I need to test it on a "live" site actually. Thank you. |
May 6, 2024 at 7:01 pm #15599093 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
Thank you, will update you shortly |
May 7, 2024 at 9:51 pm #15603916 | |
Bobby Supporter
Languages: English (English ) Timezone: America/Los_Angeles (GMT-07:00) |
After doing some additional tests, the issue persists whether it's a product created with the Divi Builder or a simple WordPress product. I also tested this on a clean sandbox with Divi and could not reproduce it. Interestingly, when logged in as an admin or user, the issue doesn't occur until after a page refresh. However, the problem persists without requiring a refresh when viewing the same product in an incognito window. I understand that disabling caching might not be feasible, but would you consider temporarily deactivating it for a quick test? Based on all tests so far this points to a caching-related behavior. This would help us verify if caching is indeed the cause of this behavior. If so, we can escalate it to our second-tier support for further investigation. |