Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection
Controller::is_block_compatible()
Verifies if the inner block is compatible with Interactivity API.
Method of the class: Controller{}
No Hooks.
Return
true|false
.
Usage
// private - for code of main (parent) class only $result = $this->is_block_compatible( $block_name );
- $block_name(string) (required)
- Name of the block to verify.
Controller::is_block_compatible() Controller::is block compatible code WC 9.6.0
private function is_block_compatible( $block_name ) { // Check for explicitly unsupported blocks. $unsupported_blocks = array( 'core/post-content', 'woocommerce/mini-cart', 'woocommerce/featured-product', 'woocommerce/active-filters', 'woocommerce/price-filter', 'woocommerce/stock-filter', 'woocommerce/attribute-filter', 'woocommerce/rating-filter', ); if ( in_array( $block_name, $unsupported_blocks, true ) ) { return false; } // Check for supported prefixes. if ( str_starts_with( $block_name, 'core/' ) || str_starts_with( $block_name, 'woocommerce/' ) ) { return true; } // Otherwise block is unsupported. return false; }