WooCommerce is loading a lot of styles

You are here:
Estimated reading time: < 1 min

Starting with WooCommerce 8.0, there’s a massive load of WooCommerce block styles which are loading regardless if those blocks are used or not.

Here’s a custom code solution to disable them:

add_action( 'wp_enqueue_scripts', function () {
	if(is_admin()) return;
	wp_dequeue_style( 'wc-blocks-style' );
	wp_dequeue_style( 'wc-blocks-vendors-style' );
	wp_dequeue_style( 'wc-blocks-packages-style' );
	global $wp_styles;
	foreach($wp_styles->registered as $registered) {
		if( strpos($registered->handle, 'wc-blocks-style-') === 0 ) {
			wp_dequeue_style( $registered->handle );
		}
	}
}, 98 );

Paste this code in your child theme’s functions.php .

Was this article helpful?
Dislike 0
Views: 156