isotropic-2022
Share
Blog
Search
Menu

How To Stop WooCommerce Scripts From Loading On "Non Shop" Pages (Optimize Scripts)

By James LePage
 on February 20, 2021
Last modified on January 7th, 2022

How To Stop WooCommerce Scripts From Loading On "Non Shop" Pages (Optimize Scripts)

By James LePage
 on February 20, 2021
Last modified on January 7th, 2022

WooCommerce is a powerful e-commerce platform with an extensive list of features that allow you to customize your store. However, it can be hard to manage all those options and keep track of which scripts are loading where. This post will show you how to optimize WooCommerce by stopping scripts from loading on pages where they're not needed.

WooCommerce comes with a lot of scripts that are designed to run automatically on all pages. These include: wc-loggedin, addtocart, cart_redirect and _wc_additional_scripts. With the other scripts running in the background it’s not always obvious which ones affect page load time because they're scattered across various pages and WordPress templates. The following code snippet will help you optimize your store by stopping unnecessary scripts from loading on pages where they're not used.

You can use AssetCleanup to stop WooCommerce scripts from loading too. This plugin can be a great help to WooCommerce store owners who want their website to load faster. This plugin can help you optimize your WooCommerce scripts by "unloading" various scripts via a GUI or regex rules.

Just to be clear, this plugin doesn't actually remove the scripts from your site. It just stops them from loading on every pageview of a customer's browser window when they enter their store. And that can make a huge difference to your customers' experience with your website, and in turn it makes you look better too!

This is one of those plugins where if you're not sure whether or not it will work for you then give it a try because there really isn't any way to lose here. The worst thing that could happen is nothing, but the best-case scenario is that everything works even more smoothly than before without having additional code slowing down load times and bogging things down on mobile devices.

Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic, a WordPress education company and digital agency. He is also the founder of CodeWP.ai, a venture backed startup bringing AI to WordPress creators.
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram