Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme()public staticWC 1.0

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

taxonomy-product_cat, taxonomy-product_tag, taxonomy-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_from_theme( $template_slug );
$template_slug(string) (required)
Slug to check for fallbacks.

BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme() code WC 8.7.0

public static function template_is_eligible_for_product_archive_fallback_from_theme( $template_slug ) {
	return self::template_is_eligible_for_product_archive_fallback( $template_slug )
		&& ! self::theme_has_template( $template_slug )
		&& self::theme_has_template( 'archive-product' );
}