Automattic\WooCommerce\Blocks\Utils

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

Код BlockTemplateUtils::template_is_eligible_for_fallback_from_theme() WC 9.3.3

public static function template_is_eligible_for_fallback_from_theme( $template_slug ) {
	$registered_template = self::get_template( $template_slug );

	return $registered_template && isset( $registered_template->fallback_template )
		&& ! self::theme_has_template( $template_slug )
		&& self::theme_has_template( $registered_template->fallback_template );
}