The Lean Cheat Sheet for When You Can’t Avoid Plugins

Download the FREE Plugin Cheat Sheet: Proven lightweight picks to reduce page weight, boost speed, and streamline your WordPress stack.

Lean Plugin Cheat Sheet Preview

Remove WooCommerce Scripts on Non-Shop Pages

WooCommerce’s storefront magic comes with baggage: a stack of JavaScript and CSS that still loads on your blog posts, landing pages and “about” screen. Those extra kilobytes slow first paint, dent Core Web Vitals and waste energy. Happily, you can strip the bloat in under an hour, and this guide walks you through every step.

Spot the slowdown from WooCommerce scripts on your non-shop pages

Run a Lighthouse quick-scan to flag sluggish posts

Open Chrome DevTools → Lighthouse and test a typical blog post. A low “Performance” score or warnings about render-blocking resources signals trouble.

Check your Core Web Vitals for hidden bottlenecks

Look at First Contentful Paint (FCP) and Total Blocking Time (TBT). If they lag behind shop pages, WooCommerce assets are likely the culprit. For a refresher on why these metrics matter, see What is sustainable web design and why it matters.

Confirm WooCommerce is the culprit

Use the DevTools Network panel to list loaded assets

Reload the same post with the Network tab open, filtered to “JS” and “CSS”. You will see files like woocommerce.js, woocommerce-layout.css and wc-cart-fragments.js, none of which your article needs.

Zero-in on wc-cart-fragments and other heavy hitters

That file alone can add 50 ms of scripting time. Note every WooCommerce handle that appears; you’ll use them in the next step.

Green hosting server icon

Ready for Faster, Greener Hosting?

We recommend Krystal - fast, reliable, powered by 100% renewable energy. It's a host we trust and a smart move for a cleaner web.

Pick the right removal method for your skill level

Toggle scripts off with Perfmatters – no code required

  1. Install PerfmattersWP Admin → Settings → Perfmatters → General.
  2. Scroll to the WooCommerce panel.
  3. Flip “Disable Scripts” to ON.
  4. Save changes.

Perfmatters will now dequeue the core WooCommerce scripts and styles on every page except product, cart, checkout, account and shop URLs, so your store remains fully functional.

Trim assets with Asset Clean Up’s Script Manager

Inside Asset Clean Up choose the page type, tick the WooCommerce files to dequeue, then apply the change site-wide to similar templates.

DIY it: a lean functions.php snippet using wp_dequeue_script

Prefer code? Drop the snippet below into a child theme or the Code Snippets plugin:

/**
 * Stop WooCommerce assets from loading on non-shop pages.
 */
add_action( 'wp_enqueue_scripts', 'lw_remove_wc_assets', 100 );

function lw_remove_wc_assets() {
	// Bail if WooCommerce isn’t active.
	if ( ! function_exists( 'is_woocommerce' ) ) {
		return;
	}

	// Keep assets only on core WooCommerce views.
	if ( ! is_woocommerce() ) {
		// Scripts
		wp_dequeue_script( 'wc-cart-fragments' );
		wp_dequeue_script( 'woocommerce' );

		// Styles
		wp_dequeue_style( 'woocommerce-general' );
		wp_dequeue_style( 'woocommerce-layout' );
		wp_dequeue_style( 'woocommerce-smallscreen' );
	}
}

The conditional guards ensure basket and checkout still work.

Stage, test, and roll back safely

Spin up a staging copy (or schedule a maintenance window)

Many hosts offer one-click staging. If yours doesn’t, schedule a quiet 30-minute window.

Run end-to-end checkout tests with Query Monitor

Activate Query Monitor to surface PHP errors, then:

  1. Add a product to cart.
  2. Apply a coupon.
  3. Complete checkout (use test gateway).
    No red flags? You’re good to ship.

Keep a one-click rollback in your back pocket

Perfmatters and Asset Clean Up let you re-enable assets instantly. For code changes, comment-out the snippet.

Measure and celebrate the win

Retest with Lighthouse and Core Web Vitals

Run Lighthouse again on the same blog post. FCP should fall and TBT should shrink. Record the before/after scores.

Calculate CO₂ savings via Website Carbon Calculator

Paste both URLs into the Website Carbon Calculator. Less transferred data equals fewer emissions. For deeper context on digital footprints, check How to calculate your website’s carbon impact.

Green service optimisation icon

The Quick Fix for a Slow, Heavy Site

We optimise your site for speed, efficiency and sustainability. No rebuild. No delays. Just better performance and a lighter footprint.


Wrap Up

Lean, fast pages please users, search engines and the planet. Removing WooCommerce’s always-on scripts is among the easiest ways to get there.

Profile photo of Neil Beckett

Neil Beckett

Neil is the founder of LeanWebs, with over ten years of experience in WordPress development. What started as a love for site speed turned into a mission to build faster, lighter, more sustainable websites.