Automattic\WooCommerce\Blocks\Templates

SingleProductTemplateCompatibility::has_single_product_template_blocks()private staticWC 1.0

Check if the Single Product template has a single product template block: woocommerce/product-gallery-image, woocommerce/product-details, woocommerce/add-to-cart-form, etc.

Method of the class: SingleProductTemplateCompatibility{}

No Hooks.

Return

true|false. True if the template has a single product template block, false otherwise.

Usage

$result = SingleProductTemplateCompatibility::has_single_product_template_blocks( $parsed_blocks );
$parsed_blocks(array) (required)
Array of parsed block objects.

SingleProductTemplateCompatibility::has_single_product_template_blocks() code WC 9.4.2

private static function has_single_product_template_blocks( $parsed_blocks ) {
	$single_product_template_blocks = array( 'woocommerce/product-image-gallery', 'woocommerce/product-details', 'woocommerce/add-to-cart-form', 'woocommerce/product-meta', 'woocommerce/product-price', 'woocommerce/breadcrumbs' );

	return BlockTemplateUtils::has_block_including_patterns( $single_product_template_blocks, $parsed_blocks );
}