Home Forums WoodMart support forum Cart quantity icon cache problem with wp-rocket

Cart quantity icon cache problem with wp-rocket

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #343599

    Hi, we are dealing with the follow problem.
    We are using wprocket for caching our site. Everything works great except that the quantity icon shows cached values.
    For example if you visit homepage and then a product page and you add a product in the cart. In that product page that you add the product, the quantity will be become “1”.
    But when you go back to the homepage that is already been cached from previous visit, the quantity will be “0”.

    So, we need not to caching the quantity on the cart icon.

    We use the follow suggestions from wp-rocket:
    1. https://docs.wp-rocket.me/article/1436-mini-cart-cached-already-has-product-in-it
    This plugin didn’t help – The problem remained

    2. https://docs.wp-rocket.me/article/27-using-wp-rocket-on-your-ecommerce-site#cart-widgets
    We exclude from WP Rocket → Advanced Rules and enter the following value in the Never Cache Cookies field: woocommerce_items_in_cart
    With that field saved on the wprocket, the icon fixed but it fixed because the cache page stopped. With that settings every time you visit a page, the page loads from the start so we don’t have caching in our site.

    After explain those to wp-rocket support they answered the follow:
    “If this plugin – WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache – doesn’t help, and if the only way to make it work is to prevent caching, then it means that your cart icon has not been coded in a way that is compatible with caching. So we won’t be able to fix this on our end.

    Please see the “Cart Widgets” section here:

    The cart icon needs to be coded with Ajax/JavaScript so that it can accurately display the quantity even when the page is cached. This is something you will have to speak with your developer, or the theme support about. Currently they are adding the quantity directly into the HTML, so it gets cached and it won’t by dynamic (i.e. it won’t change/update).

    Instead they need to fetch and display the quantity using an AJAX request. This will always be accurate even with caching”

    So, please we need your help.
    Thank you on advance



    I have checked the documentation provided by WP Rocket, I see the recommendation on the advanced rules.

    Please check this article and make sure you have excluded all the recommended files: https://space.xtemos.com/wordpress-performance-optimization-the-ultimate-guide-in-2021#Step_4

    If you have already excluded the list of the files and the problem persists, please let us know.

    Best Regards


    Dear Partners,

    I have the checked the documentation and me.
    I gave you private details to login to check by yourself and to see why is not working.
    So, i have exclude all about the documentation, so PLEASE login to the site and see by yourself that everything is setuped correctly and after that check why is not working.

    Thank you in advance.



    Please add this line into the functions.php of the child theme:
    add_filter( 'woodmart_update_fragments_fix', '__return_false' );

    Best Regards

    • This reply was modified 2 years, 3 months ago by Elise Noromit.

    Thanks for your reply. worked fine but we have the same problem with the wishlist quantity icon

    can you send us a filter to exclude this too?



    Please describe step by step how we can reproduce the problem.

    Best Regards


    We have active wp rocket and perfectly working.
    One problem of the wprocket is that preload works only for not logged in users. If a user logged in stops seeing cached pages.
    For this problem there is a solution based on this article

    So, what we do is that activated the plugin
    WP Rocket | Common Cache For Logged-in Users

    This plugin solves this problem but created the following problem
    It is caching the quantity icon of the wishlist, so all the logged in users sees the same quantity on the icon!
    For example if one logged in user adds 4 products in the wishlist and this page cached at this moment, every logged in user will see the quantity wishlist icon to appear 4 products in their wishlist, even if they don’t have nothing in their wishlist.

    The problem is not when the user visit on the wishlist page because we have exclude that page from caching.

    The problem is only in the quantity wishlist icon.

    As wp-rocket said you are the only, that you can help because we need a filter fuction to exclude it based on the theme.



    Our developers are working on this issue and this would be fixed in the nearest update.

    If you have any questions please feel free to contact us.

    Best Regards


Viewing 8 posts - 1 through 8 (of 8 total)