• Resolved simplecv

    (@simplecv)


    I have a very similar problem to this user https://www.ads-software.com/support/topic/cart-widget-caching-and-esi-block-issue/ which an issue on my WooCommerce site related to the LiteSpeed Cache plugin.

    The Cart widget counter and mini basket is sometimes disappearing from the header when the user navigates to different pages on the website. I am struggling to find a pattern because sometimes the Cart widget counter disappears and sometimes it does not, although it does seem to always disappear when I navigate to Shop > All Categories

    I disabled all features in Litespeed > Toolbox > Debug and the issue disappeared.

    I also added woocommerce_items_in_cart in Liteseed > Cache > Exclude > Do Not Cache Cookies but this had no effect.

    I cannot see any errors in Chrome browser dev tool.

    My Report number is: RQTOPROD

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter simplecv

    (@simplecv)

    I just want to add to this… the Cart Widget (on the header bar) seems to also be caching products from previous sessions. So if I hover over the Cart Widget, the cart products shown are different from the actual products in the cart. Clicking on the cart icon loads the actual cart products.

    Thread Starter simplecv

    (@simplecv)

    I found this post https://www.ads-software.com/support/topic/mini-cart-is-cached-same-cart-contents-for-multiple-users/ and I added this to .htaccess

    RewriteRule .* – [E=Cache-Vary:woocommerce_cart_hash]

    It works in staging but not on the live site. Any ideas?

    Plugin Support qtwrk

    (@qtwrk)

    do you still have that cache-vary rule added ? please generate me the latest report again on live site.

    Thread Starter simplecv

    (@simplecv)

    Thank you for your reply. I think that I have fixed this issue now.

    In addition to the rewrite rule, I needed to add “woocommerce_items_in_cart” to Litespeed > Cache > Excludes > Do Not Cache Cookies as per this tutorial https://chemicloud.com/kb/article/fix-litespeed-cache-woocommerce-conflicts/

    I would recommend adding a tutorial to the Litespeed docs as the Mini Cart issue seems to be quite a common problem. I am using Woocommerce with Avada theme, and I expect that a lot of users have this combination.

    It was also important for me to disable “Browser Cache” within Litespeed > Cache > Browser as this feature was caching the baskets of other users so the Mini Cart was displaying different products to the actual cart.

    Thread Starter simplecv

    (@simplecv)

    The problem with the Mini Cart disappearing has now started again, but only on 3 pages. Home, Skoda and Contact (I am using Avada Forms on the Contact page).

    Here is the latest report number on the live site: ITTCDBAV

    The staging site is working perfectly, with the rewrite rule only. I have not added “woocommerce_items_in_cart” to Do Not Cache Cookies on the staging site.

    • This reply was modified 1 year, 3 months ago by simplecv.
    • This reply was modified 1 year, 3 months ago by simplecv.
    Thread Starter simplecv

    (@simplecv)

    For anyone interested in Woo Mini Cart problems, this is how I have finally fixed the issue:

    • Disable Quic Cloud CDN.
    • Add “RewriteRule .* – [E=Cache-Vary:woocommerce_cart_hash]” to .htaccess

    Notes:

    • I am not a developer (experienced wordpress user maybe) but I can see that adding the code to .htaccess (rather than adding “woocommerce_items_in_cart” to Litespeed > Cache > Excludes > Do Not Cache Cookies means that the website and shop pages continue to be cached after a user has added products to the cart. This was really easy to test: Using the rewriterule, images were served as WebP after an item was added to the cart. Using the Cache > Excludes method images were served as JPegs after an item was added to the cart. I would be interest in a developer’s opinion (or Litespeed support) if anyone wants to comment regarding this…
    • I assume my initial staging testing (see my third post here) regarding the fix working in staging but not live was because I had enabled the Quic Cloud CDN. It took me a while to work out that disabling this would fix the problem. Obviously I now have no CDN, but it’s better that my cart works properly.
    • As mentioned higher up this thread, it was also important for me to disable “Browser Cache” within Litespeed > Cache > Browser as this feature was caching the baskets of other users so the Mini Cart was displaying different products to the actual cart.

    Having used SG Optimizer and WP Rocket previously, I have to say that I found Litespeed Cache very frustrating. It seems like the Woo Mini Cart issus is quite common so I therefore hope that this post helps out other users. On the plus side, having migrated my website from Siteground, due to unacceptable reliability (down time) to Chemicloud (Litespeed Server), my website is now faster.

    edited

    • This reply was modified 11 months, 2 weeks ago by fjura.
    Nils

    (@nilsbosman)

    @simplecv Thank you very much for writing down your findings and solution. Your solution also worked for me, greatly appreciated sharing the fix.

    For LiteSpeed Cache; I understand it’s very hard to write documentation that is one-size fits all, but I do believe there should be a place where these common issues are collected, explained, and list possible solutions.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Cart Widget Caching Problems’ is closed to new replies.