Automattic\WooCommerce\Blocks\Templates
ProductSearchResultsTemplate::update_search_template_hierarchy()
When the search is for products and a block theme is active, render the Product Search Template.
Method of the class: ProductSearchResultsTemplate{}
No Hooks.
Return
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() ProductSearchResultsTemplate::update search template hierarchy code WC 9.4.2
public function update_search_template_hierarchy( $templates ) { if ( ( is_search() && is_post_type_archive( 'product' ) ) && wc_current_theme_is_fse_theme() ) { array_unshift( $templates, self::SLUG ); } return $templates; }