Zero Blocks Given
Most WooCommerce stores ship 80-150 KB of block CSS and JS that the store never actually renders. The WC BlockPatterns scanner is the one that bugs me most – it hits the filesystem on every request to scan a directory of pattern templates you don’t use. Then add core WP global-styles , wp-block-libr
Most WooCommerce stores ship 80-150 KB of block CSS and JS that the store never actually renders. The WC BlockPatterns scanner is the one that bugs me most – it hits the filesystem on every request to scan a directory of pattern templates you don’t use. Then add core WP global-styles , wp-block-library and font-faces on top, and you’re loading a Gutenberg frontend you probably switched off a long time ago.
Zero Blocks Given turns it off at the source, through WooCommerce’s own dependency injection container. No CSS dequeue band-aid, no UI checkboxes, no PRO upsell. One constant in wp-config.php , pick a tier, done.
How it works
Here’s the thing – WC registers its block hooks as closures wrapping instance methods on container-managed objects. So you can’t remove_action() them by string. You have to fetch the same instance back from the DI container and pass it in as the callable. That’s what this does:
$bp = \Automattic\WooCommerce\Blocks\Package::container()->get( BlockPatterns::class ); remove_action( 'init', [ $bp, 'register_block_patterns' ] );
The DI-container path is the one that survives WC upgrades cleanly. String-callback matching and dequeue tricks tend to drift every release, so I went with the container.
Five modes. Three ways to set them.
Mode What it turns off When to use it
patterns WC BlockPatterns directory scanner only Block-based Cart/Checkout – keeps all blocks rendering, just skips the file-I/O scan
blocks patterns + BlockTypesController + Notices styles + wc-blocks-style handle Classic-shortcode WC stores
keep-styles blocks + WC Product Filter pattern scan ( ProductFilterAttribute ) Stores that don’t use WC blocks but keep Gutenberg styling – kills the expensive scans, leaves global-styles and core block rendering alone. Pixel-perfect.
all keep-styles + WP global-styles pipeline + theme.json + font-faces + head <style> strip Sites with no Gutenberg frontend at all
nuclear all + unregister_block_type() for every core block Page-builder sites – strips the editor inserter clean
Default is all . Set the mode you want with any of these:
- 01The <dialog> settings – click the Settings link on the Plugins screen. Native HTML dialog, four radios, save. No menu items, nothing else added to your admin.
- 02A constant in wp-config.php – define( 'ZEROBLG_MODE', 'patterns' ); . This wins over the dialog. Good devops escape hatch.