Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::template_is_eligible_for_product_archive_fallback()public staticWC 1.0

Checks if we can fall back to the archive-product template for a given slug.

taxonomy-product_cat, taxonomy-product_tag, taxonomy-product_attribute templates can generally use the archive-product as a fallback if there are no specific overrides.

Method of the class: BlockTemplateUtils{}

No Hooks.

Return

true|false.

Usage

$result = BlockTemplateUtils::template_is_eligible_for_product_archive_fallback( $template_slug );
$template_slug(string) (required)
Slug to check for fallbacks.

BlockTemplateUtils::template_is_eligible_for_product_archive_fallback() code WC 8.7.0

public static function template_is_eligible_for_product_archive_fallback( $template_slug ) {
	return in_array( $template_slug, self::ELIGIBLE_FOR_ARCHIVE_PRODUCT_FALLBACK, true );
}