Block Filter addFilter doesn’t work with woocommerce blocks

[ad_1]

It looks like the WooCommerce Cart Totals block or other WooCommerce blocks restrict the type of inner blocks you can place in them

I tried using a block filter to allow specific blocks but it won’t let me place them

Is there a way to override this?

const ALLOWED_BLOCKS = ['core/paragraph', 'stl/image-box']

addFilter(
'blocks.registerBlockType',
'my-plugin/extend-cart-totals-block',
(settings, name) => {
console.log(name)
if (name === 'woocommerce/cart-totals-block') {
settings.edit = (props) => {
return (
<Fragment>
<InnerBlocks allowedBlocks={ALLOWED_BLOCKS} />
</Fragment>
)
}
}
return settings
}
)

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer