Category: WooCommerce

The WooCommerce plugin defines WC_VERSION php constant to tell which version it's currently at.

If you want to check and do some actions if the version of the plugin is greater that X then you can do this.

First check if the constant is defined and then use the php function version_compare() to compare the version.

if (defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '7.0') '>=' )) {
   // do something if WooCommerce version is greater than 7.0

If the WC_VERSION constant is not defined that means that WooCommerce plugin is not installed, activated or your code is checking too early when not all plugins were loaded by WordPress just yet.

Join our mailing list

Get important news about cool products we release and invitations to beta test new products

Find out the Social networks we're on