Automattic\WooCommerce\Internal\Logging

RemoteLogger::get_wc_version │ private │ WC 1.0

Get the current WooCommerce version reliably through a series of fallbacks

Метод класса: RemoteLogger{}

Хуков нет.

Возвращает

string. The current WooCommerce version.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_wc_version();

Код RemoteLogger::get_wc_version() WC 11.3.0

private function get_wc_version() {
	if ( class_exists( '\Automattic\Jetpack\Constants' ) && method_exists( '\Automattic\Jetpack\Constants', 'get_constant' ) ) {
		$wc_version = \Automattic\Jetpack\Constants::get_constant( 'WC_VERSION' );
		if ( $wc_version ) {
			return $wc_version;
		}
	}

	if ( defined( 'WC_VERSION' ) ) {
		return WC_VERSION;
	}

	if ( function_exists( 'WC' ) ) {
		return WC()->version;
	}

	// Return null since none of the above worked.
	return null;
}