Automattic\WooCommerce\Blocks\Templates
ProductCategoryTemplate::render_block_template
Run template-specific logic when the query matches this template.
Method of the class: ProductCategoryTemplate{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ProductCategoryTemplate = new ProductCategoryTemplate(); $ProductCategoryTemplate->render_block_template();
ProductCategoryTemplate::render_block_template() ProductCategoryTemplate::render block template code WC 10.6.2
public function render_block_template() {
if ( ! is_embed() && is_product_taxonomy() && is_tax( 'product_cat' ) ) {
$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 );
}
}