• Resolved jiripazler89

    (@jiripazler89)


    Hi,

    I’d like to ask you for help with your plugin and WPML. I am trying to make it work together for 2 weeks, but unfortunately I haven’t find a working solution.

    I have two problems

    1. Now the main problem is, that LS doesn’t use 2 different caches according to currency, even if the vary cookie is set.

    I’ve added snippet:
    add_filter( ‘wcml_user_store_strategy’, function ( $strategy, $key ) {
    return ‘cookie’;
    }, 10, 2 );
    and it worked for few hours and then stopped.

    I was able to make it work by adding another custom snippet, but it stopped to work after few hours too.

    1. Problem with crawler
      When the first problem was solved, I’ve tried to set crawler to preload the cache. For the main currency it works correctly, but I have problems to set it for the second one.

    The problem is, that LSCACHE_VARY_COOKIE identified by crawler are changed regardless to the settings (this info I have from Crawler log in your plugin).
    I was able to make the crawler work (but only for few hours again). When it worked correctly, the LS identified these vary: wcml_client_currency,,wp-postpass_
    But then it stopped to work and in log were these cookies as vary: wcml_client_currency,wcml_client_currency_language,wcml_client_country,,wp-postpass
    and today there is no vary (it’s probably because of the problem #1)

    The strange thing is, that when it worked, I haven’t made any changes in the settings or on the site and it stopped to work – so I am not really sure what happens there.

    Information which could be usefull about WPML
    I use two currencies – CZK – the main currency, EUR – second currency added by WPML.
    I use only one language – cs
    I use geolocation to set currency etc.

    I’ve tried the current version of your plugin and also the oldest (version 4.6), but the problems persists. In the current version I have problem with dark mode, that’s why I’ve downgraded it.

    The report number is RXFSKROK

    I hope you’ll be able to help me, because I don’t understand why it stopped to work, when I did no changes there.

    Thank you in advance and have a nice day!

    Best regards
    Jiří Pázler

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter jiripazler89

    (@jiripazler89)

    Hi there,

    I hope you are doing well, I just have an update about the problem in the ticket.

    Problem #1
    This problem is solved by itself (at least for now – as I mentioned before, things in the past started to work, but then it stopped to work without no reason).
    I made no changes in the sttings or in the functions.php (or anywhere on the web), just two days passed and it started to work. In the functions is only the snippet mentioned above.

    I created a new report, so maybe you will be able to see what changed and why it works now? The report number is WYKIMMTC

    Problem #2
    This problem wasn’t solved by itself – in crawler log I can see correctly:
    LSCACHE_VARY_COOKIE: wcml_client_currency,,wp-postpass_xxx
    but when I simulate SK location by VPN and visit the web, the cache isn’t served

    I tried to add my snippet to functions to check, if it helps. Everything worked correctly with this snippet before (before I opened this ticket).

    After adding my snippet, everything works correctly – first visit is miss and cookies are set, so currency is shown correctly and also second page etc. is served from the cache created by crawler (even the cache with the second currency added by WPML).
    The new used snippet (for correctly setting vary)

    add_action('init', function() {
    $current_currency = isset($_COOKIE['wcml_client_currency']) ? $_COOKIE['wcml_client_currency'] : 'CZK';

    if ($current_currency !== 'CZK') {
    $vary_value = 'wcml_currency:' . $current_currency;

    if (!isset($_COOKIE['_lscache_vary']) || $_COOKIE['_lscache_vary'] !== $vary_value) {
    setcookie('_lscache_vary', $vary_value, time() + 86400 * 2, '/', '', true, true);
    $_COOKIE['_lscache_vary'] = $vary_value;
    }
    }
    }, 1);

    So now everyhing works correctly, but in the past it stopped to work without any changes and I am affraid off, that the same happens now (after few days).

    Is there something in reports what explains this behaviour, please?

    Thank you very much in advance and have a nice day!

    Best regards
    Jiří Pázler

    Plugin Support qtwrk

    (@qtwrk)

    there seems have a bug in current version about WCML for auto-vary , your manual code should fix that part

    for crawler , I’d say please try also simulate the wp-postpass_xxx cookie with _NULL , see how it goes

    Thread Starter jiripazler89

    (@jiripazler89)

    Hi,

    thank you for the reply.

    With the snippet the crawler works correctly, the problem is, that 2 days ago it stopped to work and also setting vary for manual visit stopped to work.

    On Friday, when I started the topic – when the cache with the main currency was created and I visited the page from different country, the main cache was served (there was no MISS for the first visit). And also the crawler shouldn’t work correctly.

    Yesterday I’ve tried it, and the first visit was MISS and cookies were set, so I’ve tried also add the snippet and crawler started to work. During these two days I made no changes on the website, so it started to work „by itself“. And that’s the problem. It happened to me repeatedly in the past two weeks and I am not sure why and how to fix this problem.

    One day everything works great, I go to sleep and when I wake up, it doesn’t work anymore…

    Is it in reports something, what could explain this problem? Or how to proceed with this problem? Should I let you know again when the problem appears?

    Thank you for your effort and have a nice day!

    Plugin Support qtwrk

    (@qtwrk)

    when it happens again , it will always happen? like not random but reliably reproduce ?

    in that case I’d suggest to use debug log , to detect what exactly was the vary the request falls into , it may give some clue

    Thread Starter jiripazler89

    (@jiripazler89)

    Hi,

    thank you for the answer.

    It happens randomly – few days it works and few days it doesn’t – with no changes on the site, so I am not able to reproduce it everytime, but after few days it just stops to work – as today, when it stopped to work again.

    So now the first problem is back – if the main cache (deffault currency, location etc.) is created, it always uses this cache. For better understing I’ll describe step by step what I do.

    1. I clear all cached
    2. Open anonymous window and visit a custom page
    3. The page isn’t cached = MISS, so it sets cookies – everything works fine
    4. Close the window, open a new anonymous window and visit the same page
    5. The page is served from the cache, even if it’s the first visit, so it shouldn’t = cookies aren’t set – this behaviour happens even if I use VPN to simulate another country → the page is served from the cache, so it shows the wrong currency (because the cookies weren’t set)

    Yesterday it worked as it should – all firsts visits were MISS and cookies were set, so everything worked as it should.

    I have enebled debug log few days ago, but I am not sure which information are important to this behaviour.

    I also created a new report (number WSCPPAPR) and added passwordless link. So you can check it by yourself.

    The problem is only, when the main cache (deffault currency, location etc.) is created. When I visit it from another country and main cache isn’t generated, it sets cookies correctly and also second first visit (new anonymous window) is MISS as it should.

    I will try to keep homepage – https://dev.elegantisimo.cz/ cached, so you can try it there. When you visit another page, it should set cookies correctly.

    I am sorry, if the description is too complicated (I am not sure which info are relevant to this).

    Thank you in advance and have a nice day!

    Plugin Support qtwrk

    (@qtwrk)

    no , don’t mention anything about login , it is forbidden in forum, you will get yourself banned

    10/22/25 08:37:44.663 [xxx:34624 1 het] Cookie _lscache_vary: xxxxxx:xxx
    10/22/25 08:37:44.663 [xxx:34624 1 het] X-LSCACHE: true
    10/22/25 08:37:44.663 [xxx:34624 1 het] LSCACHE_VARY_VALUE: +webp

    you will looking for lines like this , you can use lscache_vary as keyword

    Thread Starter jiripazler89

    (@jiripazler89)

    Hi,

    thank you for the reply.

    I was talking about the function from your plugin.

    About the debug
    When it worked, there was:
    Cookie _lscache_vary: wcml_currency:EUR
    X-LSCACHE: true

    And now, when the problem is back, the line with vary is completely missing. So it doesn’t distinguish caches by currency, even when the vary is set in the settings (settings is the same as before – when it worked).

    Before I created a ticket, I also tried to deactivate all plugins except WooCommerce, WPML and LS Cache, but it didn’t solve the problem. Neither switching to the default theme (Twenty Twenty-Five) didn’t help.

    Because I use Cloudflare, I tried to pause it, but it didn’t helper neither.

    So I am not sure, what could cause this problem… Because one day it works great and second one not, even if there wasn’t any change.

    Do you have any idea, please?

    Thank you and have a nice day!

    Plugin Support qtwrk

    (@qtwrk)

    maybe the htaccess file was modified ? the vary relies on htaccess rewrite rule

    without actually facing the issue, all is guessing for now , when the issue happens, please do this: export DB, zip the file , we will create a stats with issue present , and hopefully , reproducible , this will ease the investigation

    Thread Starter jiripazler89

    (@jiripazler89)

    Hi,

    thank you for the answer.

    Information about vary is correct in the htaccess, but I am not sure about the rest.

    The problem is still there, so I was able to export DB and zip it. But how I can send it to you, please?

    Thank you very much!

    Plugin Support qtwrk

    (@qtwrk)

    please create a ticket by mail to support at litespeedtech.com with reference link to this topic , we will investigate further

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Problem with compatibility between LS and WPML’ is closed to new replies.