How to Fix WooCommerce Cart Fragments Slowing Your Store

The wc-cart-fragments script fires an uncacheable request on every page. Here's how to fix it safely.

WooCommerce loads a `wc-cart-fragments` script that makes an AJAX call on every page to keep the mini-cart updated. On non-shop pages it's wasted load.

The fix (functions.php)

add_action('wp_enqueue_scripts', function () {

if (function_exists('is_woocommerce')) {

if (!is_woocommerce() && !is_cart() && !is_checkout()) {

wp_dequeue_script('wc-cart-fragments');

}

}

}, 99);

This keeps the cart working on shop pages but removes the uncacheable request everywhere else — often saving 1–2 seconds of mobile load.

Verify

WPDoctor's WooCommerce audit detects site-wide cart fragments and confirms once you've fixed it.