Automattic\WooCommerce\Internal\Logging
RemoteLogger::get_wc_version()
Get the current WooCommerce version reliably through a series of fallbacks
Method of the class: RemoteLogger{}
No Hooks.
Return
String
. The current WooCommerce version.
Usage
// private - for code of main (parent) class only $result = $this->get_wc_version();
RemoteLogger::get_wc_version() RemoteLogger::get wc version code WC 9.6.1
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 ( function_exists( 'WC' ) && method_exists( WC(), 'version' ) ) { return WC()->version(); } if ( defined( 'WC_VERSION' ) ) { return WC_VERSION; } // Return null since none of the above worked. return null; }