Automattic\WooCommerce\Blocks\Templates

ProductTagTemplate::render_block_template()publicWC 1.0

Renders the default block template from Woo Blocks if no theme templates exist.

Method of the class: ProductTagTemplate{}

No Hooks.

Return

null. Nothing (null).

Usage

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

ProductTagTemplate::render_block_template() code WC 9.4.2

public function render_block_template() {
	if ( ! is_embed() && is_product_taxonomy() && is_tax( 'product_tag' ) ) {
		$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' );
		}

		add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
	}
}