Automattic\WooCommerce\Blocks\Templates

ArchiveProductTemplatesCompatibility::is_products_block_with_inherit_query()privateWC 1.0

Check if the block is a Products block that inherits query from template.

Method of the class: ArchiveProductTemplatesCompatibility{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->is_products_block_with_inherit_query( $block );
$block(array) (required)
Parsed block data.

ArchiveProductTemplatesCompatibility::is_products_block_with_inherit_query() code WC 9.4.2

private function is_products_block_with_inherit_query( $block ) {
	return 'core/query' === $block['blockName'] &&
	isset( $block['attrs']['namespace'] ) &&
	'woocommerce/product-query' === $block['attrs']['namespace'] &&
	isset( $block['attrs']['query']['inherit'] ) &&
	$block['attrs']['query']['inherit'];
}