Automattic\WooCommerce\Blocks\Templates

ProductAttributeTemplate::update_taxonomy_template_hierarchy()publicWC 1.0

Renders the Product by Attribute template for product attributes taxonomy pages.

Method of the class: ProductAttributeTemplate{}

No Hooks.

Return

null. Nothing (null).

Usage

$ProductAttributeTemplate = new ProductAttributeTemplate();
$ProductAttributeTemplate->update_taxonomy_template_hierarchy( $templates );
$templates(array) (required)
Templates that match the product attributes taxonomy.

ProductAttributeTemplate::update_taxonomy_template_hierarchy() code WC 9.6.1

public function update_taxonomy_template_hierarchy( $templates ) {
	$queried_object = get_queried_object();
	if ( taxonomy_is_product_attribute( $queried_object->taxonomy ) && wc_current_theme_is_fse_theme() ) {
		array_splice( $templates, count( $templates ) - 1, 0, self::SLUG );
	}

	return $templates;
}