Table of Contents
Issue #
Caching plugins and plugins that use caching for certain features cause the menu cart to fail to update. This may cause issues including different displaying on mobile, seeing old displays of the cart after adjusting it and visiting a new page, etc.
Known conflicting plugins #
- WP Rocket
- W3 Total Cache
- Litespeed caching
- Elementor
- Bricks by FlyingPress
Solution #
Refresh cart fragments #
Caching generally causes this to fail. This method gives us something to reactivate the cart fragments while some caching solution is enabled for website in some form, so that they will output as normal.
Use this code snippet:
add_action( 'wp_enqueue_scripts', 'wpo_enqueue_wc_cart_fragments' ); function wpo_enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
If you haven’t worked with code snippets, read this guide: How to use code snippets
Afterwards, open a new tab or a new page to test the menu cart.