Skip to content
Gaurav TiwariDocs

Speed Up WooCommerce with the Optimizer

Updated October 17, 2026

WooCommerce loads its scripts on pages that sell nothing. Once a shopper has something in the cart, it also adds prefetch links for the Cart and Checkout block scripts to every page they visit. On the Stackless demo store, the homepage carried 52 of them, for a checkout the shopper might never open.

WooCommerce Optimizer trims that. Its defaults are safe on any store, and the stronger options are opt-in because each one has a tradeoff.

Turn It On

Enable WooCommerce Optimizer on the Stackless Dashboard, then go to Stackless → Settings → WooCommerce Optimizer. It works with any theme and with both the Checkout block and the classic checkout. Clear your page cache after every change here, or cached pages keep the old scripts.

Storefront Settings

These three are on by default:

  • Cart and checkout prefetch: stops WooCommerce prefetching the Cart and Checkout block scripts on every page, and stops the cart page pre-loading the checkout page. Checkout still loads everything it needs when the shopper gets there.
  • Defer WooCommerce scripts: loads WooCommerce’s storefront scripts (add to cart, cart fragments, the product gallery, order attribution) with defer on every page except cart and checkout. WordPress keeps a script blocking whenever another plugin needs it that way, so load order never breaks.
  • Generator tag: removes the WooCommerce version meta tag from your page source.

These are off by default:

  • Store assets: loads WooCommerce scripts and styles only on store pages. Everywhere else, such as your blog posts and About page, they’re skipped.
  • Always treat as store pages: page IDs or URL paths, one per line, such as 42 or /landing/. Use it for pages whose product widgets come from a page builder (see the next section).
  • Cart fragments: Keep (WooCommerce default), Remove outside store pages, Remove while the cart is empty, or Remove everywhere. Cart fragments refresh the classic mini cart with an AJAX request on page load. Block themes and the Mini-Cart block don’t use them.
  • Password strength meter: removes the meter, about 400 KB of JavaScript, from the account and checkout pages. WooCommerce enforces its minimum password strength in that script, so shoppers can then pick weaker passwords.
  • Order attribution: turns off order attribution tracking and its two scripts. New orders stop recording their traffic source, so the Origin column and the order screen’s attribution box stay empty.

What Counts as a Store Page

The Store assets and Cart fragments options need to know which pages sell something. A page counts as a store page when it is any of these:

  • The shop, a product, a product category or tag, the cart, the checkout or My Account.
  • A page with a WooCommerce or Stackless block, such as Product Collection, the Mini-Cart or the Stackless wishlist.
  • A page with a WooCommerce or Stackless shortcode, such as [products], [add_to_cart] or [stackless_wishlist].
  • Any page when the classic Cart widget is active in a sidebar.
  • A page listed under Always treat as store pages.

Block themes are detected from what actually renders, so a Mini-Cart block in the header makes every page a store page. That’s correct: the mini cart needs those files.

Page builders are the one blind spot. Elementor, Bricks and similar builders store layouts outside the post content, so a product grid built with their widgets isn’t seen. If a page loses its add-to-cart buttons or styling after you turn on Store assets, add that page to Always treat as store pages.

Admin Settings

All four are off by default and only affect wp-admin:

  • Marketplace suggestions: hides WooCommerce.com extension suggestions and promotions.
  • Remote inbox notes: stops WooCommerce fetching remote tips and notes into its inbox.
  • Dashboard widgets: removes the WooCommerce Status and Recent Reviews widgets from the WordPress dashboard. Each one runs its own report queries every time the dashboard loads.
  • Connect notices: hides the WooCommerce.com connection and subscription notices.

Housekeeping

Both settings keep WooCommerce’s own defaults until you change them:

  • Scheduled action logs: days to keep completed and cancelled scheduled actions. WooCommerce keeps 31. Seven is plenty for most stores and keeps the actions table small. Failed actions follow WooCommerce’s own longer retention.
  • Guest cart lifetime: hours a guest’s cart session is kept. WooCommerce keeps 48. Logged-in customers keep their saved cart either way.

Stackless’s Own Files

Separately from this module, Stackless 1.1.0 and later always serves minified copies of its own CSS and JavaScript, and loads its storefront scripts with defer. Payment gateway scripts and the Cart and Checkout block integrations keep their normal timing so card fields and wallets mount as before.

To debug with the readable files, add define( 'SCRIPT_DEBUG', true ); to wp-config.php.

Check That It Worked

  1. Add a product to the cart, then open your homepage in a private window.
  2. View the page source and search for rel='prefetch'. With the prefetch setting on, WooCommerce’s checkout scripts are gone from the list.
  3. Search for woocommerce/assets/js. Those script tags now carry defer.
  4. With Store assets on, open a blog post and search for woocommerce.css. It’s no longer there.

For Developers

  • stackless_woocommerce_optimizer_is_store_page (bool): override whether the current request is a store page.
  • stackless_woocommerce_optimizer_defer_handles (string[]): the WooCommerce script handles the module defers.
  • stackless_defer_script (bool, handle): return false to keep one Stackless script blocking.

Good to Know

  • Settings take effect on the next page load, but page caches and CDNs serve the old HTML until you purge them.
  • Caching and optimization plugins that combine or delay scripts work alongside this module. If you use their “delay JavaScript” feature, exclude the Checkout block and payment scripts there as you normally would.
  • Turning the module off restores WooCommerce’s default behavior right away. Nothing is deleted.
Share

Was this helpful?

Still stuck? Open a support ticket