• Resolved pstidsen

    (@pstidsen)


    Hi there,

    I am using the currency features inside WPML. That gives multiple cache version of the same URL because the currency can be changed based on the value of the wcml_currency cookie. As far as I know, that cookie-vary is controlled through _lscache_vary.

    The problem is, that the currency vary feature will always make the first hit a miss because the wcml_currency cookie is not set on the first visit. However, in 95+ % of the cases, I will know what currency the customer want to see based on the URL/domain (.se => SEK, .com => EUR, .no => NOK etc.).

    Therefore: Is it possible to set some kind of fallback so if the cookie is not set, LiteSpeed will serve the version based on the fallback-guess?

    Hope it makes sense..

    Best Regards,
    Peter

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

    (@qtwrk)

    unfortunately in current system, it is meant to give cache miss on the very first request, in order to properly set the cookie for language/currency

    Thread Starter pstidsen

    (@pstidsen)

    Hi @qtwrk

    Thanks for your reply. What would it take to make a fallback feature? Is it something I could implement 3rd party on my own site? Or would it require changes in WPML or LiteSpeed?

    In many languages (domains) the most used currency could easily be set as default fallback leading to fewer misses.

    Plugin Support qtwrk

    (@qtwrk)

    I have spent quite some time and efforts on this

    only possible way I can think of is that to add query string to URI , like /something/?currency=USD , /something/?currency=EUR …etc , when there is no different content on same URI , that way , no need cookie to vary

    but I don’t think WPML/WCML has such option

    Thread Starter pstidsen

    (@pstidsen)

    Hi @qtwrk,

    I think you are right. There is no such URL-parameter option.

    I have tested deactivating the wcml_currency vary cookie. However, that could lead to showing the incorrect currency, if the cached page is somehow in the non-default currency. It has led to a few customer inquiries but on the other hand, I really like that the first page visit is now often a hit instead of a miss.

    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;
    }
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fallback vary cookie based on URL’ is closed to new replies.