-
-
Notifications
You must be signed in to change notification settings - Fork 0
Dequeue WooCommerce Cart Fragments
If you use WooCommerce, you know that it runs an AJAX call on every page load to get changes for the Cart. That is done always, regardless of the need for it, and in most cases, it is not needed and should be disabled. That can't be fully done through WooCommerce settings, but the script to do it is quite simple. If you want to learn more about WooCommerce Cart Fragments, there are plenty of resources on the internet.
Make sure you understand what the Cart Fragments are, and if you really need them or not, and use this code accordingly!
It is quite simple, it will dequeue WooCommerce wc-cart-fragments
script on all WordPress pages, except on product archives and single product pages. Line 20 controls the conditions for this removal, and you can modify it if needed.