woocommerce_has_block_template хук-фильтрWC .

Filters the value of the result of the block template check.

Использование

add_filter( 'woocommerce_has_block_template', 'wp_kama_woocommerce_has_block_template_filter', 10, 2 );

/**
 * Function for `woocommerce_has_block_template` filter-hook.
 * 
 * @param boolean $has_template  value to be filtered.
 * @param string  $template_name The name of the template.
 *
 * @return boolean
 */
function wp_kama_woocommerce_has_block_template_filter( $has_template, $template_name ){

	// filter...
	return $has_template;
}
$has_template(true|false)
value to be filtered.
$template_name(строка)
The name of the template.

Список изменений

С версии . Введена.
Since x.x.x

Где вызывается хук

WC_Template_Loader::has_block_template()
woocommerce_has_block_template
woocommerce/includes/class-wc-template-loader.php 171
return (bool) apply_filters( 'woocommerce_has_block_template', $has_template, $template_name );

Где используется хук в WooCommerce

woocommerce/includes/blocks/class-wc-brands-block-templates.php 21
add_filter( 'woocommerce_has_block_template', array( $this, 'has_block_template' ), 10, 2 );
woocommerce/src/Blocks/Templates/CartTemplate.php 52
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/CheckoutTemplate.php 52
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php 74
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductCatalogTemplate.php 62
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php 68
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductSearchResultsTemplate.php 61
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductTagTemplate.php 68
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/SingleProductTemplate.php 85
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );