Disable Cart Fragments


Completely disables the AJAX cart fragments feature in WooCommerce for a huge boost in loading speed (redirect to cart page highly recommended).

Our related OSS projects:

The Long Version

Disable Cart Fragments is a simple plugin that disables the AJAX ‘cart fragments’ feature in WooCommerce. That feature automatically updates the cart total in your shopping cart without having to refresh the page. The problem with this is that is severely slows down many WooCommerce websites especially on shared hosting servers. Plus, the feature isn’t even used in many cases. We recommend that if you install this plugin, you either disable it selectively on certain pages (see the Installation tab) or if installing as one-click then make sure you enable ‘redirect to cart page’ option in WooCommerce settings so that when a customer adds a product to their Cart, it redirects to the Cart page automatically so as to not confuse them about what happened to their chosen product.

This plugin removes e.g.

/* <![CDATA[ */
var wc_cart_fragments_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","wc_ajax_url":"\/about?wc-ajax=%%endpoint%%","fragment_name":"wc_fragments"};
/* ]]> */
<script type='text/javascript' src='//example.com/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js'></script>

You can selectively disable using a defined constant:

define('DISABLE_CART_FRAGMENTS', '123,456,789');

For initial release we’ve implemented via dequeue rather than print scripts, will review based on feedback.


This plugin has been designed for use on LEMP (Nginx) web servers with PHP 7.0 and MySQL 5.7 to achieve best performance. All of our plugins are meant for single site WordPress installations only; for both performance and security reasons, we highly recommend against using WordPress Multisite for the vast majority of projects.

Defined Constants

The following defined constants are supported by this plugin:

  • define('DISABLE_NAG_NOTICES', true);
  • define('DISABLE_CART_FRAGMENTS', '123,456,789');

Plugin Features

  • Settings Page: No
  • Premium Version Available: Yes (Speed Demon)
  • Includes Media (Images, Icons, Etc): No
  • Includes CSS: No
  • Database Storage: Yes
    • Transients: No
    • Options: Yes
    • Creates New Tables: No
  • Database Queries: Backend Only (Options API)
  • Must-Use Support: Yes (Use With Autoloader)
  • Multisite Support: No
  • Uninstalls Data: Yes

WP Admin Notices

This plugin generates multiple Admin Notices in the WP Admin dashboard. The first is a notice that fires during plugin activation which recommends several related free plugins that we believe will enhance this plugin’s features; this notice will re-appear approximately once every 6 months as our code and recommendations evolve. The second is a notice that fires a few days after plugin activation which asks for a 5-star rating of this plugin on its WordPress.org profile page. This notice will re-appear approximately once every 9 months. These notices can be dismissed by clicking the (x) symbol in the upper right of the notice box. These notices may annoy or confuse certain users, but are appreciated by the majority of our userbase, who understand that these notices support our free contributions to the WordPress community while providing valuable (free) recommendations for optimizing their website.

If you feel that these notices are too annoying, than we encourage you to consider one or more of our upcoming premium plugins that combine several free plugin features into a single control panel, or even consider developing your own plugins for WordPress, if supporting free plugin authors is too frustrating for you. A final alternative would be to place the defined constant mentioned below inside of your wp-config.php file to manually hide this plugin’s nag notices:

define('DISABLE_NAG_NOTICES', true);

Note: This defined constant will only affect the notices mentioned above, and will not affect any other notices generated by this plugin or other plugins, such as one-time notices that communicate with admin-level users.


Free Plugins

Premium Plugins

Special Thanks


We released this plugin in response to our managed hosting clients asking for better access to their server, and our primary goal will remain supporting that purpose. Although we are 100% open to fielding requests from the WordPress community, we kindly ask that you keep the above-mentioned goals in mind… thanks!


  1. Upload to /wp-content/plugins/disable-cart-fragments-littlebizzy
  2. Activate via WP Admin > Plugins
  3. Test the plugin by refreshing pages and checking source code after clearing caches
  4. To disable cart fragments on specific posts/pages (using their ID), refer to below defined constant:

    define(‘DISABLE_CART_FRAGMENTS’, ‘123,456,789’);


Installation Instructions
  1. Upload to /wp-content/plugins/disable-cart-fragments-littlebizzy
  2. Activate via WP Admin > Plugins
  3. Test the plugin by refreshing pages and checking source code after clearing caches
  4. To disable cart fragments on specific posts/pages (using their ID), refer to below defined constant:

    define(‘DISABLE_CART_FRAGMENTS’, ‘123,456,789’);

Does this plugin disable my WooCommerce shopping cart?

Nope, it only disables AJAX features of add-to-cart. Refreshing the page will still show cart totals in worst case scenarios, but in most scenarios the add-to-cart functions are not apparently changed.

Are there other recommendations to keep in mind?

Yes, you should enable redirect to cart page in WooCommerce settings to ensure customers aren’t confused. This will make sure that after adding an item to their Cart, they are automatically redirected to the Cart page each time. You should also disable AJAX add to cart on archives page because this plugin disables that AJAX site-wide by default.

How can I change this plugin’s settings?

This plugin does not have a settings page and is designed for speed and simplicity.

I have a suggestion, how can I let you know?

Please avoid leaving negative reviews in order to get a feature implemented. Instead, we kindly ask that you post your feedback on the wordpress.org support forums by tagging this plugin in your post. If needed, you may also contact our homepage.


Working! Thanks!

I tried some code in my child theme and it did not work. With this plugin, I could fix the problem!

Pretty good…

Works – but not with PHP 5.3. It is easy to make it work with this version, if you change the references to arrays in a few places.

Read all 24 reviews

Contributors & Developers

“Disable Cart Fragments” is open source software. The following people have contributed to this plugin.




  • updated plugin meta


  • added WC support plugin headers (meta) to plugin root file


  • added WC support plugin headers (meta) to readme


  • tested with WooCommerce 3.4
  • tested with PHP 7.1
  • tested with PHP 7.2
  • tested with alleged conflicting plugins e.g. WooCommerce Cart, WooCommerce Better Usability, etc
  • plugin uses PHP namespaces
  • plugin uses object-oriented codebase
  • optimized plugin code (e.g. moved notices to new folder, etc)


  • added warning for Multisite installations
  • updated recommended plugins


  • tested with WP 4.9
  • support for DISABLE_NAG_NOTICES


  • added WP.org rating request notice
  • updated recommended plugins
  • optimized plugin code


  • minor code tweaks
  • updated recommended plugins


  • updated recommended plugins


  • added recommended plugins notice


  • tested with WP 4.8


  • updated plugin meta


  • updated plugin meta


  • initial release
  • tested with PHP 7.0