• Resolved Randika

    (@harunstudio)


    Hi,

    I’ve encountered an issue on my WooCommerce site related to the LiteSpeed Cache plugin.

    It seems that my cart widget is being cached, which results in it not updating correctly when items are added or removed. Specifically, when I add a product to the cart, and then visit the homepage, the cart widget still shows “0” items, even though it should show “1”.

    Here are the steps I’ve already taken to troubleshoot the issue:

    1. Disabled All Features: I turned off all the caching features in the plugin, and the issue disappeared
    2. Rolled Back to Version 5.5: I reverted the plugin to version 5.5, but the issue persists.
    3. Disable Only Cache: Issue dissapeared.

    I also tried to replace the cart with an ESI Block:
    [esi cart_icon cache=”no-store” ttl=”0″]

    This solved the issue, but after a day or maybe a few hours, the cart icon disappears from my website’s header and only reappears after I clear the cache.

    Can you advise on how to permanently fix this while using the caching capabilities?

    Thank you

    P.S: I use GeneratePress theme

    • This topic was modified 1 year, 3 months ago by Randika.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please provide the report number , you can get it in toolbox -> report -> click “send to LiteSpeed”

    and when you see that cart icon disappears, do you see any error in browser dev tool ?

    Thread Starter Randika

    (@harunstudio)

    Okay, this is my report number: KJSAVFKG

    When it disappeared, I remember that I had inspected and checked the console tab, but I didn’t see any errors, but maybe I need to double-check.

    Currently, I have disabled the ESI Block and replaced the cart with the default theme / non ESI block.

    Plugin Support qtwrk

    (@qtwrk)

    you may need to open the dev tool BEFORE you access

    Thread Starter Randika

    (@harunstudio)

    I believe I have done a hard refresh in inspect and indeed I did not see any errors. Can you suggest something or are you sure there is an error causing the cart icon to disappear?

    I am also having issues with the cart being cached, I enabled ESI but no changes. I use disable cart fragments which I believe is apart of the issue but usually works fine on all other sites

    Plugin Support qtwrk

    (@qtwrk)

    if it works for 20-ish hours , then it sounds like a nonce issue , and if it’s nonce issue , it should , usually , gives 401 or 403 error in dev tool

    is it always reproducible ?

    you can also try go to Toolbox -> debug setting -> set it to ON , log level to advance , and in debug include URI , add lsesi , this should at least log the request that is sending to ESI block.

    Thread Starter Randika

    (@harunstudio)

    I’ve further investigated the issue regarding the cart icon and have gathered some insights based on the HTML structure. I’d like to share my observations with you:

    When the Cart Icon Appears:

    • The HTML block for the cart icon is present.
    • Comments indicate that this part is not cached by LiteSpeed Cache (Block uncached by LiteSpeed Cache 5.6).
    • The X-LiteSpeed-Cache-Control is set to no-cache, meaning it isn’t stored in cache.
    <div class="menu-bar-items"><a  class="cart-contents shopping-cart has-svg-icon" title="View your shopping cart"><span class="gp-icon shopping-cart">
                    <svg xmlns="https://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bag" viewBox="0 0 16 16">
      <path d="M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1zm3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-3.5zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5z"></path>
    </svg>
                </span><span class="number-of-items ">2</span><span class="amount">Rp360.000</span></a>
    <!-- Block uncached by LiteSpeed Cache 5.6 on 2023-08-26 04:06:48 -->
    <!-- X-LiteSpeed-Cache-Control: no-cache -->
    <!-- Full varies: +webp --></div>

    When the Cart Icon Disappears (after about 24 hours):

    • The entire cart icon block is missing from the HTML structure.
    • Comments indicate this section has been cached by LiteSpeed Cache (Block cached by LiteSpeed Cache 5.6).
    • The X-LiteSpeed-Cache-Control is set to public,max-age=604800, meaning it’s cached and has a cache lifespan of 604800 seconds (7 days).
    <div class="menu-bar-items">
    <!-- Block cached by LiteSpeed Cache 5.6 on 2023-08-25 17:15:32 -->
    <!-- X-LiteSpeed-Cache-Control: public,max-age=604800 -->
    <!-- Full varies: +webp -->
    <!-- X-LiteSpeed-Tag: 189_HTTP.200,189_HTTP.301,189_ --></div>

    Given these observations, it seems there’s an inconsistency in how LiteSpeed Cache handles the cart icon portion. While initially, it seems not to be cached, after some time it looks like it gets cached and subsequently disappears.

    I’d appreciate any insights or recommendations you have regarding these observations.

    Plugin Support qtwrk

    (@qtwrk)

    now this is interesting issue?

    does this always happen every 24 hours ?

    Thread Starter Randika

    (@harunstudio)

    Sometimes, after 24 hours or more, I need to clear the CSS/JS cache to restore the cart icon. This is frustrating, especially since I don’t enable any CSS or JS optimization.

    Plugin Support qtwrk

    (@qtwrk)

    purge js/css is useless in this case, it only works because it is linked to purge page cache as well

    please create a ticket by mail to support at litespeedtech.com with reference link to this topic , let’s try to reproduce the issue and investigate further.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Cart Widget Caching and ESI Block Issue’ is closed to new replies.