Automattic\WooCommerce\Internal\Admin

SiteHealth::get_theme_template_override_pathprivateWC 1.0

Get the path to a theme template override, if one exists.

Method of the class: SiteHealth{}

No Hooks.

Returns

String|false.

Usage

// private - for code of main (parent) class only
$result = $this->get_theme_template_override_path( $file );
$file(string) (required)
Template file.

SiteHealth::get_theme_template_override_path() code WC 11.0.0

private function get_theme_template_override_path( $file ) {
	$paths = array(
		get_stylesheet_directory() . '/' . $file,
		get_stylesheet_directory() . '/' . WC()->template_path() . $file,
		get_template_directory() . '/' . $file,
		get_template_directory() . '/' . WC()->template_path() . $file,
	);

	foreach ( $paths as $path ) {
		if ( file_exists( $path ) ) {
			return $path;
		}
	}

	return false;
}