WooCommerce sites, especially large ones, almost always encounter load time issues with the following AJAX request.
Even on our small WooCommerce test site, it took longer than any other request and wasn’t needed as this was on the homepage. On large sites, we have seen this account for up to 10-second delays. That’s right, 10 seconds.
Disable WooCommerce cart fragments
To disable WooCommerce cart fragments when nothing is in the cart, follow the steps below. Make sure you have WooCommerce installed and activated first.
Click into the Perfmatters plugin settings.
Make sure you’re on the “General” submenu.
Scroll down to the “WooCommerce” section and toggle on “Disable Cart Fragmentation.” The feature will check to see if the
woocommerce_cart_hash cookie exists, meaning something is in the cart. If the cookie isn’t present, then the cart fragments script will be disabled. This retains functionality while fixing the performance issue.
Scroll down and click “Save Changes.”
Alternative: Delay cart fragments script
If you have any issues with the feature above due to your theme, an alternative is to simply delay the
Troubleshooting cart fragments
The cart fragments feature and or AJAX request in WooCommerce is used to update the cart total without refreshing the page. However, this definitely comes at a cost, and a lot of times depending upon your theme, isn’t even used or needed.
Some themes also allow you to change how your shopping cart works. So we’ve seen that some will use our Perfmatters feature to disable cart fragments and then change the shopping cart functionality with a theme option to get better results.
If your theme only has an option to turn the shopping cart on or off, another route we’ve seen that sometimes works is to turn it off and instead use a free plugin like WP Menu Cart for the shopping cart.