Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 29 replies, has 0 voices.

Last updated by Itamar 3 days, 23 hours ago.

Assisted by: Itamar.

Author Posts
July 2, 2025 at 3:44 pm #17194109

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I have a reply from our second-tier supporter.

Our second-tier supporter thinks it could be related to another ticket you can see here, as the wcml_client_country cookie appears to be the issue, based on the feedback you provided.

1. He doesn't think that the custom plugin is necessary here since WP Rocket has already registered our cookies, see hidden link">mandatory cookies and hidden link">dynamic cookies. But if the custom plugin is necessary, you will have to edit this part to add the correct values for wcml_client_country and wcml_client_currency:

    $cookies = [
        'currency' => [
            'usd',
            'eur',
        ],
        /*
        'lang' => [
            'en',
            'es',
        ],*/
    ];

2. Could you try the solution provided by us in the other ticket?

Edit the file classes/multi-currency/geolocation/GeolocationBackendHooks.php (in WCML), and replace:

class GeolocationBackendHooks implements \IWPML_Backend_Action, IStandAloneAction {

With:

class GeolocationBackendHooks implements \IWPML_Frontend_Action, \IWPML_Backend_Action, IStandAloneAction {


**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Note: If that works, it will pre-cache variants of pages with one currency. The other currency variants will not be pre-cached; instead, they will be cached on the first matching visit.

Regards,
Itamar.

July 3, 2025 at 8:51 am #17195892

jiriP-10

Hi Itamar,

thank you for the reply.

Point #1
The additional helper plugin has to be installed, without it WP Rocket preloads cache without any cookie value, which can't be served to customers with cookies (country, currency, language ...).
And settings in the plugin is right. The code you sent is just an example, that's why the code had to be changed in the plugin (as I mentioned before).

Point #2
The provided solution doesn't work for me. If I understand it well, only one currency, one location and one language can be preloaded? Because that's how it works without any changes. The reason why I created a ticket is, that I need to preload content for both countries.

Here I would go back to the one question from the begining - is it possible somehow use the price which is set in WPML currency as the end price? It means - the price which I set there would be used for all customers with that currency - no matters of tax rates - so the same price would be used for customers with 10 % vat rate and also with 20 % vat rate etc. This solution would allow me to preload the cache for all countries without need any other changes (because the problem is that with 21 % vat rate for CZ I am not able to preload content with 23 % vat rate for SK).

Thank you and have a nice day!

Best regards
Jiří Pázler

July 3, 2025 at 10:11 am #17196555

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

To have the same price in different currencies, you need to select the
'Set prices in other currencies manually' option. Please read about it here: https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#set-custom-prices-in-different-currencies.

I hope this solution is helpful for you.

Regards,
Itamar.

July 3, 2025 at 12:00 pm #17197098

jiriP-10

Hi Itamar,

thank you for the reply.

I already use this function, the problem is, that that's not the end price. For example:
I set price manually to 30 € and for Czech republic (with VAT rate 21 %) the price will be 30 €. But for Slovakia (where is VAT rate 23 %), the price will be different. Here is what WPML does:
1. It takes this price and counts the price without the tax (30/1,21=24,79)
2. And then it adds SK VAT rate (24,79*1,23=30,49)
So I set price 30 € and this price will be only for Czech republic (or any other country where is VAT rate 21 %), but for Slovakia the price will be 30,49 (and also different for all other countries where the VAT rate is different).

What I need to achieve is, that if I set 30 €, than this price will be applicated to all countries no matters of tax rate. Basically - the end price for customer will be the same and what changes is price without the tax.

There are already plugins which works like that, but I need to use WPML, so it's shame that there is no sttings for this inside the plugin, but I hope that you will be able to provide me some code, which makes it possible.

This is the part, which causing me problems with preloading.

I hope that I explained it well.

Thank you in advance and have a nice day!

Best regards
Jiří Pázler

July 3, 2025 at 1:41 pm #17197617

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Jiří.

I'm consulting our second-tier supporter about your point. As far as I know, the settings for displaying prices, including or excluding tax, are WooCommerce settings and not WooCommerce Multilingual & Multicurrency settings. Please see the attached screenshot. But let's wait for our second-tier supporter to comment on this. I'll keep you updated here.

Regards,
Itamar.

July 3, 2025 at 2:50 pm #17198002

jiriP-10

Hi Itamar,

thank you for the reply.

I don't see any attachment, but it never mind I guess.

Yes, tax settings is from WooCommerce, I know. The problem is, that doesn't matter if I use setting price with or without tax, I am not able to achieve the result when the prices for two countries (with the different VAT rate) will be the same.

I understand why it happens - WooCommerce counts from the price without the tax. But if you sell physical products to end customers, in some countries (CZ, SK etc.) you have to show end price including tax. So if I want to sell product for SK customers for 30 €, I have to enter 29,512195 in your plugin (in same cases there have to be up to 6 decimals). And then there is this problem, when I am not able to preload the cache because from some reason, even if the right cookies are used for preloading.

For example this plugin - hidden link - allows me to enter prices for countries, so if I enter some price, this price will be used and I don't have to enter price with 6 decimals when I know for how much I want to sell it. I understand, that for some businnesses doesn't matter how the end price looks like, because they usually show the price without VAT, but for some businesses like me it's important (also because of cash on delivery in some countries has specific rules - you can't pay for example price with 1 cent, because they don't use cents smaller than 5 etc.)

So I think that would be great to have a possibility to choose how I want to use these prices.

I hope that you understand what I mean and I'll be waiting for more info from tier 2.

Thank you!

Best regards
Jiří Pázler

July 3, 2025 at 9:54 pm #17199417

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi Jiri.

I've sent your comment to our second-tier supporter.

Please note that my weekend is Friday-Saturday, and I'll be able to continue to check this issue and help you on Sunday.

Regards,
Itamar.

July 6, 2025 at 6:21 pm #17205359

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our second-tier supporter has reviewed this case, and here is his thorough explanation.

Point #1: WP Rocket cookies and preload cache.

WP Rocket documentation already includes support for WPML cookies, and these are properly taken into account when creating the "normal" page cache (triggered when a user visits a page).

The additional plugin you are using is meant to help with the **preload cache** (caching pages automatically without requiring a first visit). In this preload context, you can set cookie values ahead of time.

A few important notes here:

The integration with WPML in WP Rocket was implemented by our developers and is implemented on the WP Rocket side. However, at the time, the preload cache feature was not yet available, so it may not be fully compatible yet.

If the preload feature causes issues, we recommend disabling it for now and relying on the normal (visit-triggered) cache. Please see the attached screenshot.

Regarding your current implementation, there seems to be a configuration issue. Your example currently defines combinations of cookies like this:

$cookies = [
    [
        'wcml_client_currency' => 'CZK',
        'wcml_client_currency_language' => 'cs',
        'wcml_client_country' => 'CZ',
    ],
    [
        'wcml_client_currency' => 'EUR',
        'wcml_client_currency_language' => 'cs',
        'wcml_client_country' => 'SK',
    ],
];

However, the recommended approach is to define possible values per cookie, like this:

$cookies = [
    'wcml_client_currency' => ['CZK', 'EUR'],
    'wcml_client_currency_language' => ['cs'],
    'wcml_client_country' => ['CZ', 'SK'],
];

We suggest trying to adjust the implementation accordingly.

Point #2: Preload cache compatibility

As mentioned above, the preload option might not yet be fully compatible with WPML. However, the normal cache (based on user visits) will continue to work as expected.

Point #3: Using the final price including tax

Yes, you can set your product prices as the final price (including taxes) in WooCommerce. To do this, go to WooCommerce > Settings > Tax and set:
"Prices entered with tax" → "Yes, I will enter prices inclusive of tax".
This way, the price you set on the product will be considered the final price, including tax.

Point #4: Site settings observations

After reviewing your site configuration, we noticed:

- In WPML > WooCommerce Multilingual > Multi-currency, both currencies (CZK and EUR) are currently enabled for all countries. From your description, it appears that you intend to use CZK only for the Czech Republic (CZ) and EUR only for Slovakia (SK).

- The WP Rocket core plugin is currently deactivated on your site.

I hope this information will be helpful to you.

Regards,
Itamar.

image.png
July 7, 2025 at 8:47 am #17207152

jiriP-10

Hi,

Point #1
If I use only preload function from WP Rocket (without the helper plugin) it creates a cache, which won't be used - because this cache is created without any cookies and your plugin uses cookies. You can try it by yourself - so your plugin isn't compatible with WP Rocket preload function (if I don't use the helper plugin).

Settings of the helper plugin.
I tried both settings -combinations of cookies and also possible values per cookies - well, the result was the same, it doesn't work as it should. The reason, why it doesn't work properly is that, it doesn't preload prices correctly - it preloads price with 21 % VAT rate instead of 23 % VAT rate.

Point #3
I use entering prices with tax, well, the problem is, that the price is different for countries with different rate - you can see that in the attached printscreen. If would be possible to use the same price for all countries, it would solve my problem with preloading.

Point #4
I'd like to use EUR only for Slovakia, but if I'll do it, the preload function won't work completely - it preloads content for Slovakia with CZK currency.

The problem with preloading function is, that your plugin doesn't allow WP Rocket preload pages properly. Bellow is explanation from WP Rocket support tier 2.

------------
Indeed, with WCML Multicurrency, the problem is not about the setup of cookies by ouir helper. That is working as expected.

The issue is happening because is not enough just to set the cookies with our preload plugin, WCML also triggers functionality to change currencly, language, location, etc with a different logic. It is happening earlier.
--------------

So in this case, the easiest way how to solve this problem would be to use final prices for all countries (no matter which VAT rate they use). Is it possible to achieve that somehow?

Thank you.

Best regard
Jiří Pázler

geo.png
July 7, 2025 at 8:13 pm #17211175

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Thanks for the detailed response. I conveyed it to our second-tier supporter. I'll update you here once I have his reply.

I appreciate your patience.
Itamar.

July 8, 2025 at 1:56 pm #17214394

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our second-tier supporter instructed me to ask if you agree to taking a copy of your site for further escalation of this issue to our developers. For this, I must install a plugin like Duplicator or All In One Migration. Please let me know if you agree.

I want to set expectations and let you know that our second-tier supporter has informed me that the issue will likely not receive high priority. This may change if we get more reports about this issue.

Regards,
Itamar.

July 9, 2025 at 11:28 pm #17221281

jiriP-10

Hi Itamar,

this problem (problem with different prices) I've already solved - this behaviour is caused by WooCommerce - the way how it counts prices, but I was able to add filter to disable non base location prices.

Still I have some problems with the preloading, but for now I am not sure if it's caused by WPML or WP Rocket, so I have to investigate it.

You can make the copy of the staging site, if it helps you. The main problem, that WP Rocket hasn't access to the cookies for preloading is still there (that's why the preloading doesn't work correctly for different locations - countries), so it would be great if it could be fixed from your side - by developers from WPML and WP Rocket together.

I am trying to solve this problem in different ways, because changing WPML/WP Rocket isn't solution for me.

When I will have more information about the preloading I'll update this ticket or should I create a new one?

Thank you and have a nice day!

Best regards
Jiří Pázler

July 10, 2025 at 11:46 am #17223576

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Jiří.

Thanks for providing this information. If I understand it correctly, then you are unsure if WPML has caused this issue. If you find further information related to preloading and WPML, please reply to this ticket.

Regards,
Itamar.

July 11, 2025 at 7:29 am #17226435

jiriP-10

Hi Itamar,

thank you for the reply.

Well, the original problem (the problem, that the WP Rocket can't use cookies from WPML for preloading - different currency - if it's not allowed for the main country, different vat rates etc. is caused by WPML - at least according to what WP Rocket tier 2 support said). So this problem should be fixed from your side with cooperation with WP Rocket - I am not 100 % sure what is the problem there - I am not so familiar with these things).

And now I am trying to solve this problem in different ways - like allowing currency for all countries (even if I didn't want to), disabling non base location prices etc. And here I found new problems with preloading - sometimes WP Rocket preloads it well, sometimes not - and here I have to investigate if the problem is cause by WP Rocket or WPML.

When I will have more information, I'll update the ticket.

Thank you and have a nice day!

Best regards
Jiří Pázler

July 13, 2025 at 8:52 am #17230817

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Jiří.

Our second-tier supporter attempted to take a copy of your site using the All In One Migration plugin but was unsuccessful. He will try it with another migration plugin.

Regarding the following, you wrote:

I am trying to solve this problem in different ways, because changing WPML/WP Rocket isn't solution for me.

Our second-tier supporter mentioned this:

In the meantime, the client can simply deactivate the preload cache option from WP Rocket as mentioned before. The plugin will still cache pages on the first visit.

I'll keep you updated when I have news about this case.

I appreciate your patience.
Itamar.