WC_Install::check_version()public staticWC 1.0

Check WooCommerce version and run the updater is required.

This check is done on all requests and runs if the versions do not match.

{} It's a method of the class: WC_Install{}

Return

null. Nothing.

Usage

$result = WC_Install::check_version();

Code of WC_Install::check_version() WC 6.7.0

public static function check_version() {
	$wc_version      = get_option( 'woocommerce_version' );
	$wc_code_version = WC()->version;
	$requires_update = version_compare( $wc_version, $wc_code_version, '<' );
	if ( ! Constants::is_defined( 'IFRAME_REQUEST' ) && $requires_update ) {
		self::install();
		/**
		 * Run after WooCommerce has been updated.
		 *
		 * @since 2.2.0
		 */
		do_action( 'woocommerce_updated' );
		do_action_deprecated( 'woocommerce_admin_updated', array(), $wc_code_version, 'woocommerce_updated' );
		// If there is no woocommerce_version option, consider it as a new install.
		if ( ! $wc_version ) {
			/**
			 * Run when WooCommerce has been installed for the first time.
			 *
			 * @since 6.5.0
			 */
			do_action( 'woocommerce_newly_installed' );
			do_action_deprecated( 'woocommerce_admin_newly_installed', array(), $wc_code_version, 'woocommerce_newly_installed' );
		}
	}
}