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.

Метод класса: BlockTemplateUtils{}

Хуков нет.

Возвращает

true|false.

Использование

$result = BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme( $template_slug );
$template_slug(строка) (обязательный)
Slug to check for fallbacks.

Код BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme() WC 7.3.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' );
}