Automattic\WooCommerce\Blocks\Templates

ProductSearchResultsTemplate::update_search_template_hierarchypublicWC 1.0

When the search is for products and a block theme is active, render the Product Search Template.

Method of the class: ProductSearchResultsTemplate{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ProductSearchResultsTemplate = new ProductSearchResultsTemplate();
$ProductSearchResultsTemplate->update_search_template_hierarchy( $templates );
$templates(array) (required)
Templates that match the search hierarchy.

ProductSearchResultsTemplate::update_search_template_hierarchy() code WC 10.8.1

public function update_search_template_hierarchy( $templates ) {
	if ( ( is_search() && is_post_type_archive( 'product' ) ) && wp_is_block_theme() ) {
		array_unshift( $templates, self::SLUG );
	}
	return $templates;
}