Automattic\WooCommerce\Internal\Admin

SiteHealth::has_outdated_template_overridesprivateWC 1.0

Determine whether the active theme has outdated WooCommerce template overrides.

Method of the class: SiteHealth{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->has_outdated_template_overrides();

SiteHealth::has_outdated_template_overrides() code WC 11.0.0

private function has_outdated_template_overrides() {
	$core_templates = WC_Admin_Status::scan_template_files( WC()->plugin_path() . '/templates' );

	foreach ( $core_templates as $file ) {
		$theme_file = $this->get_theme_template_override_path( $file );

		if ( ! $theme_file ) {
			continue;
		}

		$core_version  = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file );
		$theme_version = WC_Admin_Status::get_file_version( $theme_file );

		if ( $core_version && $theme_version && version_compare( $theme_version, $core_version, '<' ) ) {
			return true;
		}
	}

	return false;
}