Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::template_is_eligible_for_fallback_from_theme()
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_fallback_from_theme( $template_slug );
- $template_slug(string) (required)
- Slug to check for fallbacks.
BlockTemplateUtils::template_is_eligible_for_fallback_from_theme() BlockTemplateUtils::template is eligible for fallback from theme code WC 9.4.2
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 ); }