Disable WooCommerce Blocks

In this tutorial I am going to show you two options:

  1. First of all we are going to turn off WooCommerce Gutenberg blocks in settings (Block Manager).
  2. If it is not enough, then I will show how to completely disable specific WooCommerce blocks (or all of them).

As a result we will do something like this:

Disable WooCommerce blocks with allowed_block_types_all hook

And we are going to do that without plugins!

Turning off WooCommerce Gutenberg Blocks in Preferences

I already talked about in here, actually you do not have to force disable Gutenberg blocks in your code. Anyway, before doing it, please consider turning off blocks in Preferences > Blocks (former Block Manager appeared in WordPress 5.2).

Using Block Manager to turn off WooCommerce Gutenberg blocks

Disable WooCommerce Gutenberg Blocks in the Code

At the moment of writing this tutorial WooCommerce does not have a filter hook to prevent some of the blocks from being registered, so I am going to show you how to do it with the help of allowed_block_types_all filter hook (former allowed_block_types).

There is a whole tutorial about this filter hook on my website.

Anyway, it is not difficult for me to explain one more time how allowed_block_types_all works.

  • By default this filter hook returns true, which means that all the blocks are allowed by default.
  • If you pass into this filter hook an array of block names, like [ 'core/image', 'core/paragraph' ] – only these particular blocks will be allowed in Gutenberg.
  • You can use WP_Block_Type_Registry::get_instance()->get_all_registered() to get all the blocks registered by plugins, which can help you. I will show you below, how.

Example 1. Whitelist WooCommerce Blocks

The easy one, let’s suppose that’ve inserted this code into your (child) theme functions.php file:

add_filter( 'allowed_block_types_all', 'misha_allow_2_woo_blocks' );
function misha_allow_2_woo_blocks( $allowed_blocks ){
	$allowed_blocks = array(
	return $allowed_blocks;

And the result:

Disable WooCommerce blocks with allowed_block_types_all hook

Example 2. Blacklist WooCommerce Blocks

As you probably understood from our previous example, when you’re using allowed_block_types_all, you have two options:

  • Either specify all the possible block you would use in your code…
  • … or to get the blocks in the code somehow.

WP_Block_Type_Registry::get_instance()->get_all_registered() will help us with it. This is how:

add_filter( 'allowed_block_types_all', 'misha_allowed_blocks' );
function misha_allowed_blocks( $allowed_blocks ) {
	$registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
 	// specify all the blocks you would like to disable here
	unset( $registered_blocks[ 'woocommerce/all-products' ] );
	unset( $registered_blocks[ 'woocommerce/all-reviews' ] );
	// etc ...
	// now $registered_blocks contains only blocks registered by plugins, but we need keys only
	$registered_blocks = array_keys( $registered_blocks );
	// merge the whitelist with plugins blocks
	$allowed_blocks = array_merge( 
	return $allowed_blocks;

Please let me explain that a little bit:

  • Line 3. Variable $allowed_blocks is equal 1 at the beginning unless allowed_block_types_all is not hooked somewhere else.
  • Line 5. This method allows us to get the objects as an associative array of all the blocks registered by plugins, and widget blocks by the way. So $registered_blocks will contain all the WooCommerce blocks as well. But this method doesn’t return default Gutenberg blocks like paragraph, list etc.
  • Lines 8-9. As $registered_blocks is an associative array, we can easily remove a block element from there if we know its slug. All the WooCommerce block slugs are listed below.
  • Line 13. We don’t need objects, just block names (slugs).
  • Lines 17-22. Unfrotunately we have to pass default block names manually. The full list of default block names (slugs) is here.

List of WooCommerce Gutenberg Block Slugs

Block slugBlock name
woocommerce/all-reviewsAll Reviews
woocommerce/featured-categoryFeatured Category
woocommerce/featured-productFeatured Product
woocommerce/handpicked-productsHand-picked Products
woocommerce/product-best-sellersBest Selling Products
woocommerce/product-categoriesProduct Categories List
woocommerce/product-categoryProducts by Category
woocommerce/product-newNewest Products
woocommerce/product-on-saleOn Sale Products
woocommerce/products-by-attributeProducts by Attribute
woocommerce/product-top-ratedTop Rated Products
woocommerce/reviews-by-productReviews by Product
woocommerce/reviews-by-categoryReviews by Category
woocommerce/product-searchProduct Search
woocommerce/product-tagProducts by Tag
woocommerce/all-productsAll Products
woocommerce/price-filterFilter Products by Price
woocommerce/attribute-filterFilter Products by Attribute
woocommerce/active-filtersActive Product Filters

And here is the list of default Gutenberg block names/slugs.

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X