Disable WooCommerce Blocks
In this tutorial I am going to show you two options:
- First of all we are going to turn off WooCommerce Gutenberg blocks in settings (Block Manager).
- 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:

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).

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(
'core/paragraph',
'woocommerce/handpicked-products',
'woocommerce/product-on-sale',
);
return $allowed_blocks;
}
And the result:

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(
array(
'core/image',
'core/paragraph',
'core/heading',
'core/list',
),
$registered_blocks
);
return $allowed_blocks;
}
Please let me explain that a little bit:
- Line 3. Variable
$allowed_blocks
is equal1
at the beginning unlessallowed_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 slug | Block name |
---|---|
woocommerce/all-reviews | All Reviews |
woocommerce/featured-category | Featured Category |
woocommerce/featured-product | Featured Product |
woocommerce/handpicked-products | Hand-picked Products |
woocommerce/product-best-sellers | Best Selling Products |
woocommerce/product-categories | Product Categories List |
woocommerce/product-category | Products by Category |
woocommerce/product-new | Newest Products |
woocommerce/product-on-sale | On Sale Products |
woocommerce/products-by-attribute | Products by Attribute |
woocommerce/product-top-rated | Top Rated Products |
woocommerce/reviews-by-product | Reviews by Product |
woocommerce/reviews-by-category | Reviews by Category |
woocommerce/product-search | Product Search |
woocommerce/product-tag | Products by Tag |
woocommerce/all-products | All Products |
woocommerce/price-filter | Filter Products by Price |
woocommerce/attribute-filter | Filter Products by Attribute |
woocommerce/active-filters | Active Product Filters |
And here is the list of default Gutenberg block names/slugs.

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
Nice article