Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
WCML shows the default currency, regardless of location.
Solution:
If you're experiencing this issue, we recommend continuing to use WP Rocket instead of switching to Siteground Optimizer. Ensure that both the WPML and WCML plugins are active, as WP Rocket requires these to function correctly with WooCommerce Multilingual. For a detailed view, please check this specific line of code.

Please follow these steps:
1. Use FTP or File Manager to access your site's file system.
2. Navigate to /wp-contents/wp-rocket/inc/3rd-party/plugins/ecommerce and open "woocommerce-multilingual.php" in the editor.
3. Replace the code on Line 10:

function rocket_wcml_has_requirements() {<br />return defined( 'ICL_SITEPRESS_VERSION' )<br />&& version_compare( ICL_SITEPRESS_VERSION, '4.4.11', '>=' )<br />&& defined( 'WCML_VERSION' )<br />&& version_compare( WCML_VERSION, '4.12.6', '>=' );<br />}

With:

function rocket_wcml_has_requirements() {<br />return defined( 'WCML_VERSION' )<br />&& version_compare( WCML_VERSION, '4.12.6', '>=' );<br />}

4. Save the changes, clear both your site and browser's cache, and then test again.

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 further assistance is needed, please open a new support ticket at WPML support forum.

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 21 replies, has 2 voices.

Last updated by Prosenjit Barman 6 months ago.

Assisted by: Prosenjit Barman.

Author Posts
May 8, 2024 at 10:31 am #15605392

mohamed-nawfelO

I have contacted both WP Rocket and Siteground support and a friend who's an advanced developer. All have the exact same answer.

My friend developer helped pin point the issue. Here is her answer:

Clearly the the plugin is not compatible with SiteGround Dynamic Caching NOR with WP Rocket cache.

To confirm it's not compatible les's use WPML test page since it's simpler widget
hidden link

1. Disable WP Rocket
2. Enable Siteground optimizer
3. Disable Dynamic cache
hidden link
hidden link
4. Clear Siteground Cache
5. Perform a check from Algeria from incognito. Then another from France from another browser incognito.

*** The currency works perfectly. ***

6. Enable Dynamic cache
hidden link
hidden link
7. Clear Siteground Cache
8. Perform a check from Algeria from incognito. Then another from France from another browser incognito.

*** The currency does not work anymore. In this test, the only caching mechanism used is Siteground Dynamic cache. ***

9. The next step is to exclude WPML's Cookies from caching. This can be performed via a filters hidden link
Here you can find the snippet: hidden link as you can see here:

*** Bypassing WPML cookies is not enough. Either support is missing something that should be bypassed or plugin is simply unusable.

By the way I also tested to do the the opposite by disabling Siteground Dynamic Cache (SG Optimizer must remain active) and enabling WP Rocket's cache. Also doesn't work. ***

----

@Prosenjit, I know you're trying to help but could you please either pass on this ticket to someone with more experience or ask your technical team?

May 9, 2024 at 4:01 am #15608339

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi Nawfel,
Thank you so much for the detailed update.

I have escalated the issue to our 2nd tier team, with all the information you have shared for further investigation. As soon as I have any update from them, I will surely inform you.

Thank you so much for your patience and kind cooperation in this matter.

Best regards,
Prosenjit

May 13, 2024 at 3:17 am #15618289

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Nawfel,
I hope you're doing well.

I've received some updates from the second-tier team and am sharing them below.

Since the issue was initially reported with the WP Rocket plugin, it is advisable to continue using WP Rocket rather than switching to Siteground Optimizer. Our team will also conduct further testing with WP Rocket as well.

WP Rocket supports compatibility with WooCommerce Multilingual, however, it is essential to keep the WPML Plugin active. The WP Rocket team has integrated constants for both WPML and WooCommerce Multilingual in their code; but, the function will work correctly only if both the WPML and WCML are active. For more detailed insights, please review hidden link">this specific line of code.

However, caching support for the standalone version of WooCommerce Multilingual (without the WPML plugin) seems to be not integrated yet.

Could you please try the following steps to see if they resolve the issue?

- Use FTP or File Manager to access your site's file system.
- Navigate to /wp-contents/wp-rocket/inc/3rd-party/plugins/ecommerce and open "woocommerce-multilingual.php" in the editor.
- Replace the code on Line 10:

function rocket_wcml_has_requirements() {
	return defined( 'ICL_SITEPRESS_VERSION' )
		&& version_compare( ICL_SITEPRESS_VERSION, '4.4.11', '>=' )
		&& defined( 'WCML_VERSION' )
		&& version_compare( WCML_VERSION, '4.12.6', '>=' );
}

With:

function rocket_wcml_has_requirements() {
	return defined( 'WCML_VERSION' )
		&& version_compare( WCML_VERSION, '4.12.6', '>=' );
}

- Save the changes, clear both your site and browser's cache, and then test again.

Please check and let me know how it goes. I will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

May 13, 2024 at 9:56 am #15619734

mohamed-nawfelO

Hi Prosenjit,

I will have to do this operation multiple times — every time WP rocket has an update...

I have an WPML Agency plan, can't I just activate WPML on the website? If yes, is there anything I need to setup for this work?

Best,
Nawfel

May 13, 2024 at 9:57 am #15619736

mohamed-nawfelO

Hi Prosenjit,

Thanks for your message.

In your proposes solution, I will have to do this operation multiple times — every time WP rocket has an update...

Since I have anWPML Agency plan, can't I just activate WPML on the website? If yes, please let me know exactly what I should do for it work properly.

Best,
Nawfel

May 13, 2024 at 11:44 am #15620613

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi Nawfel,
Thank you for the update.

If the solution worked, our development team will evaluate the best way to integrate it. If integration into WCML is possible, we will proceed with that approach. If not, we will reach out to the WP Rocket team and coordinate the necessary steps. So, please feel free to go ahead and apply the solution for now.

Additionally, since you have the Agency plan, you can activate the WPML plugin on your site. Please refer to the guide provided below, activate the WPML plugin, complete the setup, and you should be all set.

- https://wpml.org/documentation/getting-started-guide/

Let me know the update. I will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

May 14, 2024 at 2:52 pm #15626164

mohamed-nawfelO

Hello Prosenjit,

Thanks for your help. It worked.

Could you please implement this in the plugin for future updates?

Best,
Nawfel

May 15, 2024 at 6:07 am #15627699

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Nawfel,
Thank you so much for the update.

I'm glad to hear that the solution worked. Our development team will check further and decide whether to integrate it into our plugin or WP Rocket. I will keep you updated with any further information on this matter.

Till then, please continue using the solution!

Best regards,
Prosenjit