Skip to content

WooCommerce cart fragments: the AJAX call that slows every page

Best practices1 min readFixes check woo-cart-fragments

cart-fragments.js can fire an uncacheable request on every page. Disable it outside the cart and checkout.

Step by step, with screenshots: WooCommerce cart fragments: stop the AJAX call on every page →

Check your own site

Runs this check and the other 186, free, in about 45 seconds.

What a passing site looks like

  • No cart-fragments request on this pagewarning · −1.5 ptseffort S

WooCommerce cart fragments

Why it matters. cart-fragments.js fires a wc-ajax=get_refreshed_fragments request to keep the mini-cart count fresh. Since WooCommerce 7.8 it loads only with the Mini-Cart widget or block; here it still loads on a page that is not the cart, often because a theme or plugin enqueues it. The request bypasses the page cache, so every visit costs a PHP request, and it delays the page for a feature most pages do not show.

How to fix it.
  1. Disable cart fragments on pages that are not the cart or checkout. WooCommerce has no setting for it: use the "Disable cart fragments" option in Perfmatters or a similar performance plugin, or a small snippet that dequeues wc-cart-fragments outside the cart, checkout and account pages.
  2. If the header shows a live cart count, load the count from a lightweight endpoint on cart changes only.

Filed under WordPress & WooCommerce. Copy is generated from the same catalogue that scores every report, so what you read here is what the report says.