Disable WooCommerce Cart Fragments

Often slow performance and errors on WooCommerce sites are caused by a high number of AJAX requests, as these requests are uncached. If you are running a WooCommerce site on WP Engine and notice a high number of AJAX requests, disabling Cart Fragments AJAX may help improve your site’s stability.


About WooCommerce Cart Fragments

WooCommerce “Cart Fragments” is a script using admin ajax to update the cart without refreshing the page. This functionality will slow down the speed of your site or break caching on pages that don’t actually require cart information.

For example, Cart Fragments on static posts, pages, custom post types and feed pages that contain no eCommerce functionality will decrease cacheability and ultimately degrade server performance.

You can identify the Cart Fragments on a site on WP Engine’s Page Performance Tool, any web page speed test, or your site’s Access Log with the following query argument added to your domain:

http://testsite.wpengine.com/?wc-ajax=get_refreshed_fragments

The Cart Fragments will appear as follows in your Access Log:

31/Dec/2017:23:59:59 +0000|v1|1.1.1.1|www.testsite.wpengine.com|200|210|127.0.0.1:80|0.328|0.330|POST /?wc-ajax=get_refreshed_fragments HTTP/2.0||


Disable Cart Fragments

  1. Add a plugin with a cart fragmentation disabling feature, such as “Disable Cart Fragments” or “Perfmatters”, to your site.
  2. Follow this guide to disable cart fragmentation through editing the functions.php file of your theme.

NEXT STEP: Read about WooCommerce Best Practices

Still need help? Contact support!

We offer support 24 hours a day, 7 days a week, 365 days a year. Log in to your account to get expert one-on-one help.

The best in WordPress hosting.

See why more customers prefer WP Engine over the competition.