Automattic\WooCommerce\Blocks\Templates

ProductCatalogTemplate::render_block_templatepublicWC 1.0

Run template-specific logic when the query matches this template.

Method of the class: ProductCatalogTemplate{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ProductCatalogTemplate = new ProductCatalogTemplate();
$ProductCatalogTemplate->render_block_template();

ProductCatalogTemplate::render_block_template() code WC 10.8.1

public function render_block_template() {
	if ( ! is_embed() && ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) && ! is_search() ) {
		$compatibility_layer = new ArchiveProductTemplatesCompatibility();
		$compatibility_layer->init();

		$templates = get_block_templates( array( 'slug__in' => array( self::SLUG ) ) );

		if ( isset( $templates[0] ) && BlockTemplateUtils::template_has_legacy_template_block( $templates[0] ) ) {
			add_filter( 'woocommerce_disable_compatibility_layer', '__return_true' );
		}
	}
}