Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::template_is_eligible_for_product_archive_fallback()public staticWC 1.0

Checks if we can fallback to the archive-product template for a given slug

taxonomy-product_cat and taxonomy-product_tag 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( $template_slug );
$template_slug(строка) (обязательный)
Slug to check for fallbacks.

Код BlockTemplateUtils::template_is_eligible_for_product_archive_fallback() WC 6.8.0

public static function template_is_eligible_for_product_archive_fallback( $template_slug ) {
	$eligible_for_fallbacks = array( 'taxonomy-product_cat', 'taxonomy-product_tag' );

	return in_array( $template_slug, $eligible_for_fallbacks, true )
		&& ! self::theme_has_template( $template_slug )
		&& self::theme_has_template( 'archive-product' );
}