• I was testing with the Twenty Twenty Three theme, WooCommerce, the WooCommerce Mini Cart widget in the header, and the Advanced presets for Litespeed cache, and I noticed that the Mini Cart didn’t always reflect the correct cart contents, sometimes would suddenly empty when I hovered the mouse over it, and did not always show the correct contents if I clicked the icon.

    The Mini Cart worked just fine with Litespeed Cache disabled, so it looks like an issue with Litespeed Cache itself.

    I found this post, and added the suggested fix to my .htaccess, which seems to have fixed the problem:

    <IfModule LiteSpeed>
    RewriteEngine on
    RewriteRule .* - [E=Cache-Vary:woocommerce_cart_hash]
    </IfModule>

    Since this is a default WordPress theme, and WooCommerce is so common, I’m wondering if you would consider adding the fix to Litespeed Cache if WooCommerce is installed, or maybe as an option, as you have for other WooCommerce-related problems?

Viewing 7 replies - 1 through 7 (of 7 total)
  • @linux4me2 thanks for your help!

    Your code also solved the same problem in my ecommerce.

    It seems that the shopping cart is no longer privately cached. Perhaps this is related to the fact that the option “Privately Cache Cart” no longer exists under the Cache > WooCommerce tab.

    Obs: the option still exists in the documentation.

    Regards

    Thread Starter linux4me2

    (@linux4me2)

    Hi @zeh32, I noticed that option is no longer there in the UI, too. It served to confuse me for a while. : )

    I’m hoping @qtwrk adds something to handle this by default or via an options when he gets the opportunity.

    Plugin Support qtwrk

    (@qtwrk)

    okay , please forgive my silly question , I am trying to reproduce the issue , but how did you create the mini-cart in 2023 theme ?

    Thread Starter linux4me2

    (@linux4me2)

    Hi @qtwrk, thanks for taking the time to look at this.

    The short version: I created the mini cart in 2023 by editing the header template part, adding a row above the site name and navigation row, and using the WooCommerce Mini Cart Widget.

    The long version:

    1. On a site with WooCommerce installed and the Twenty Twenty Three theme active, go Admin > Appearance > Editor.
    2. Click Template Parts in the left sidebar.
    3. Click Header.
    4. Click the pencil icon to the right of the “Header” title in the left sidebar to enter the “edit” mode for the header template part.
    5. In the toolbar at the top of the Editor, click on the three, staggered horizontal lines (or use the shortcut keys Shift+Alt+O) to open List View.
    6. Click the down-arrow to the left of the first group listed in the List View sidebar to expand the group.
    7. Hover your cursor over the first row listed in the group, click the kebab (Options) menu that appears at the right on hover, and choose “Insert before.”
    8. The Editor will add a paragraph block by default.
    9. Click the plus sign in the paragraph block the Editor added and type “row” in the Search box, then select Row to convert the paragraph block to a row block.
    10. Click the plus sign in the row, type “mini cart” in the Search box, then select it to insert the Mini Cart block in the row.
    11. Click the Save button at top right (probably twice) to save your changes.

    That isn’t the only method with the Editor, but it will get you a quick-and-dirty Mini Cart block to test. Note that by default, the Mini Cart block is hidden on the Cart and Checkout pages. You can change that in the settings for the Mini Cart block you added by clicking the Mini Cart block to select it and opening the Settings right sidebar–if it’s not already open–by clicking the Settings icon just to the right of the Save button at top right of the Editor.

    When you’re done testing, you can remove all your changes and revert to the default settings by returning to edit the header template part, and at the middle of the top of your screen, click on “Header.” Make sure that “header” is selected in the Area drop-down, and click the option to “Clear customizations.”

    If I can help, @qtwrk , my problem is 100% related to cache. The theme I am using is Flatsome.

    The products on the mini cart sometimes appear for other users, and the code @linux4me2 provided also solved my problem.

    • This reply was modified 1 year, 5 months ago by José.
    Plugin Support qtwrk

    (@qtwrk)

    I was able to reproduce the issue, will forward to our devs for further investigation

    @zeh32 per WP forum guideline, please create a new topic for your issue

    Thread Starter linux4me2

    (@linux4me2)

    Thank you @qtwrk!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WooCommerce Mini Cart Problems’ is closed to new replies.