• Hi there,

    I have found out, that there is an incompatibility between the multicurrency feature in the WooCommerce Multilingual & Multicurrency plugin and LiteSpeed Cache. As far as I can see, the _lsvary cookie is set because the currency conversion rate could change “soon”, leading to incorrect prices.

    How could I cache the pages anyway? At least it should be okay to cache them for 12 or 24 hours because the conversion rates are not changed more than daily. Ideally, the pages should be cached just as normal pages. What would it require doing that? Should the prices in other currencies be loaded by AJAX?

    Best Regards,
    Peter

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support qtwrk

    (@qtwrk)

    you mean it’s like you have a real-time conversion the currency from one to another ?

    real-time and cache are never the best friend , so don’t really have good solution

    you can either 1) reduce the cache time , like you said , 12-24 hours or something you see fit

    or 2) purge the cache once conversion is triggered , less cache-efficiency , but more accurate numbers

    Thread Starter pstidsen

    (@pstidsen)

    Hi @qtwrk

    I do not mean real time conversion. The conversion rate is updated once daily. But big changes are rare, so normally the price wouldn’t change more than a cent.

    I think the issue is that the WooCommerce Multilingual & Multicurrency plugin set a cookie (wcml_currency) based on what currency the visitor has selected. That means that the same URL can be viewed with different currencies.

    However, in my case and setup, the same URL will always have the same cookie value for the same URL.

    Is it possible to fix this cookie issue?

    Best Regards,
    Peter

    Thread Starter pstidsen

    (@pstidsen)

    Hi again,

    I have looked further into the issue and the cookie is actually set by the Litespeed plugin here: https://github.com/litespeedtech/lscache_wp/blob/master/thirdparty/wcml.cls.php

    I think it could be for handling different currencies on the same URL, but in my case that’s not necessary because there is only one currency pr URL. Is it possible to deactivate that third party fix, then?

    Best Regards,
    Peter

    Plugin Support qtwrk

    (@qtwrk)

    well , please forgive my bluntness , I still don’t fully understand the issue , but if you have narrow down to that file , have you tried just add return; at top of that page to bypass it and see if it works as you expected ?

    Thread Starter pstidsen

    (@pstidsen)

    Hi there,

    I have tried to add the following code in order to avoid the _lsvary cookie.

    add_filter('litespeed_vary', 'unset_litespeed_wcml_vary_cookie', 99);
    function unset_litespeed_wcml_vary_cookie($vary_list){
    if (isset($vary_list['wcml_currency'])){
    unset($vary_list['wcml_currency']);
    }

    return $vary_list;
    }

    That helps indeed, the URL’s can now be cached according to test tool check.lscache.io. However, the navigating to the exact same URL, after confirming a hit in the test tool, gives a miss in an incognito browser. How can I debug that https://app.screencast.com/ghzLm0ZLEOumB ?

    Plugin Support qtwrk

    (@qtwrk)

    the checker doesn’t exactly work like a real browser

    you can try re-open that page again on private window, and see if it gives you cache on 2nd or later access

    Thread Starter pstidsen

    (@pstidsen)

    Hi there,

    I think the checker was generating the non-webp version of the cache while visiting the URL in my own browser generated the webp version of the cache.

    Plugin Support qtwrk

    (@qtwrk)

    yes , the checker just a simple curl command with few headers, won’t have full range of request headers as a real browser does

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.