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

Published: 3 months ago

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.

Join Our Newsletter
Here's what you get: A once a week newsletter that contains original content, aggregated posts, WordPress deals, and anything else we think you'd like. We don't spam or sell your email address. Unsub at any time.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Affiliate Disclosure: Some links on this website are affiliate links. We make commissions for purchases made through those links.

We only recommend items/tools that we've personally used and like.

Full Disclosure | FTC Statement

Join Our Newsletter
Over 4,000 Design Lovers and Problem Solvers.

Author

A relationship driven website creation company.

Connect

© ISOTROPIC, LLC 2016-2021
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram