For those developers who work a lot with WooCommerce dependency checking and version compatibility are always on our minds. To make life a bit easier Woo introduced back in 2017 with version 3.2 a compatiblity check which showed in admin a warning notice if plugins dependant on WooCommerce were not tested / compatible with the latest Woo version. This was meant to allow admins to decide if they wanted to udpate now or wait until the other plugins released new versions.

The new functionalty was also referenced in the Woo plugin developer handbook (last checked March 2022 when this advice was still included).

When I was developing my new Stock Management for WooCommerce plugin I added the two tags but could not get it to display on the update page and I also found no information on everyone’s favourite search engine DuckDuckGo 😉

I was aware that WooCommerce had moved from SemVer versioning to WordPress versioning with v5.0 in effect removing the major / minor update distinctions. The first two numbers became the version number, the third number denoted a patch. The Woo team wrote an in-depth article on how they came to this decision and what it meant for developers and store owners.

But not highlighted in this article was another change which meant that from version 5.0 the compatibility check on the update page was removed. From v5.0 onwards, no checks are carried out, and “WC requires at least” and “WC tested up to” are not used to warn admins if plugin versions aren’t tested. Instead, the Woo team has commited to make all future versions backward compatible.

For developers this means that the 2 tags are now obsolete. I can still see some value in including the tags for internal use but it won’t have any visible result on the update page.

The Code

The change in version 5.0 of WooCommerce is commented in the code in /woocommerce/includes/class-woocommerce.php:

/** Define if we're checking against major, minor or no versions in the following places:
		 *   - plugin screen in WP Admin (displaying extra warning when updating to new major versions)
		 *   - System Status Report ('Installed version not tested with active version of WooCommerce' warning)
		 *   - core update screen in WP Admin (displaying extra warning when updating to new major versions)
		 *   - enable/disable automated updates in the plugin screen in WP Admin (if there are any plugins
		 *      that don't declare compatibility, the auto-update is disabled)
		 *
		 * We dropped SemVer before WC 5.0, so all versions are backwards compatible now, thus no more check needed.
		 * The SSR in the name is preserved for bw compatibility, as this was initially used in System Status Report.
		 */
		$this->define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'none' );

If you look into /woocommerce/includes/admin/plugin-updates/class-wc-plugin-updates.php you will see a return function if WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE constant matches “none” which is now true for every install since v5.0:

public function get_untested_plugins( $new_version, $release ) {
		// Since 5.0 all versions are backwards compatible.
		if ( 'none' === $release ) {
			return array();
		}

And digging a bit deeper I also found the related PR “Deactivate untested plugin’s notices #28840” by claudiosanches.

So there’s the solution to the mystery why the update notice was not showing!

Leave a Reply

Your email address will not be published. Required fields are marked *