Store performance (WooCommerce)

For developersVersion 1.0.0Last updated:

Store

  • “Load WooCommerce only in the store” (Performance → Settings → Advanced → Cache and WordPress, on; option woo_assets). WooCommerce loads its CSS and JS on all pages; BuilderOS removes them (like Perfmatters):
    • on pages that aren’t part of the store (without WooCommerce blocks or shortcodes or “WooCommerce page”);
    • on the product page and shop built with BuilderOS widgets (they don’t use them: they have their own sheet, inline with “Inline critical CSS”);
    • never on cart, checkout or My account;
    • the cart fragments (jQuery + wc-cart-fragments) only with products in the cart. The Cart widget’s counter is updated by builder-os-woo.js (no jQuery): without products it makes no request; with page cache it is corrected with the Store API if there is a cart cookie.
    • Safe: wp_dequeue_* only removes from the queue; if another plugin depends on a WooCommerce script, WordPress loads it anyway. Filter builder_os_woo_keep_assets.
    • WooCommerce’s order attribution (sourcebuster and wc-order-attribution) is kept but loaded when the page finishes (off the critical path; it needs to see the landing page). With “Delay JavaScript” that option does it.
  • Store JS (builder-os-woo.js, ≈15 KB unminified, no jQuery): brought in by a loader of a few bytes when the page finishes or on first interaction. Without it everything works (WooCommerce forms and links).
  • CSS: builder-os-woo.css only with store widgets; builder-os-woo-pages.css only on cart, checkout and My account (or the WooCommerce layout). Both inline with “Inline critical CSS”.
  • Images: the first gallery photo without lazy and with high priority; in the shop, the first row of the grid without lazy; on other pages the grids are deferred; library srcset/sizes.
  • Page cache: it never stores the cart, checkout or My account (their paths, also translated), nor pages with WooCommerce cart or session cookies (woocommerce_items_in_cart, woocommerce_cart_hash, wp_woocommerce_session_*); product pages, the shop and categories are stored.

Universal fixes that came out of measuring

  • Page cache: if a WooCommerce page (cart, checkout or account) had been deleted, its exclusion was “*” and no page was stored in the cache. Now only those that exist and have their own path are excluded.
  • Viewer: its sheet (builder-os-lightbox.css) no longer blocks painting (it only styles what its JS creates when it opens).
  • Announcement bar: builder-os-layout.js only loads if it can be closed (before, any bar loaded it on all pages).
  • Fonts: on a site without packages using “Site design”, the text font (local Latin woff2) is preloaded: no layout shift (CLS) when the font changes.
  • Remove theme styles: also on pages with sections that BuilderOS paints full screen with “On the whole site” (even if they don’t have the canvas turned on).
  • Fixed header: when loading at the very top it doesn’t force a style calculation (builder-os-nav.js).
  • Theme template buttons: the .bos-tpl .bos-btn rule of the default layout no longer overrides the widgets’ buttons (.bos-w-btn), which now follow the site’s accent.