top view photography of broken ceramic plate

woocommerce_add_to_cart_fragments not working since version 7.8

The Cart Fragments script, responsible for updating the cart widget after a successful add-to-cart event, can cause a performance issue on stores not making use of that functionality. To mitigate this, the script will now only be enqueued if using the Mini Cart widget.

This change was implemented with WooCommerce 7.8.

Stores with similar functionality (e.g. from a theme) that are not using the widget can re-enable this functionality by either adding the widget to one of their widget areas/sidebars or by enqueuing the script manually:

function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );

If you’re looking for an alternative to the Mini Cart widget that does not suffer from the performance issue, try the Mini Cart Block instead.

You can read more about this change below:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.