Commit 1ca88692d96 for woocommerce
commit 1ca88692d965222c1546d6b30a5c0f569dd259bf
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Fri Aug 7 10:32:25 2026 +0100
Fix WP-CLI exiting on missing `wp-cli/extension-command` package (#67074)
diff --git a/plugins/woocommerce/changelog/35858-fix-wp-cli-exit-without-extension-command b/plugins/woocommerce/changelog/35858-fix-wp-cli-exit-without-extension-command
new file mode 100644
index 00000000000..bcd9e10d2ae
--- /dev/null
+++ b/plugins/woocommerce/changelog/35858-fix-wp-cli-exit-without-extension-command
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+WP-CLI no longer exits the whole process when the optional wp-cli/extension-command package isn't installed.
diff --git a/plugins/woocommerce/changelog/fix-wp-cli-blueprint-duplicate-class-load b/plugins/woocommerce/changelog/fix-wp-cli-blueprint-duplicate-class-load
new file mode 100644
index 00000000000..f2ee2146ebd
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-wp-cli-blueprint-duplicate-class-load
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+WP-CLI's blueprint command no longer risks a fatal error from loading its class twice.
diff --git a/plugins/woocommerce/includes/class-wc-cli.php b/plugins/woocommerce/includes/class-wc-cli.php
index 90450da083d..b3339e499d1 100644
--- a/plugins/woocommerce/includes/class-wc-cli.php
+++ b/plugins/woocommerce/includes/class-wc-cli.php
@@ -65,7 +65,9 @@ class WC_CLI {
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Update_Command::register_commands' );
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tracker_Command::register_commands' );
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Command::register_commands' );
- WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Extension_Command::register_commands' );
+ if ( class_exists( 'WC_CLI_COM_Extension_Command' ) ) {
+ WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Extension_Command::register_commands' );
+ }
if ( defined( 'WOOCOMMERCE_MIGRATOR_ENABLED' ) && WOOCOMMERCE_MIGRATOR_ENABLED ) {
WP_CLI::add_hook( 'after_wp_load', 'Automattic\WooCommerce\Internal\CLI\Migrator\Runner::register_commands' );
}
@@ -80,7 +82,6 @@ class WC_CLI {
*/
public function add_blueprint_cli_hook() {
if ( FeaturesUtil::feature_is_enabled( 'blueprint' ) && class_exists( \Automattic\WooCommerce\Blueprint\Cli::class ) ) {
- require_once dirname( WC_PLUGIN_FILE ) . '/packages/blueprint/src/Cli.php';
WP_CLI::add_hook( 'after_wp_load', 'Automattic\WooCommerce\Blueprint\Cli::register_commands' );
}
}
diff --git a/plugins/woocommerce/includes/cli/class-wc-cli-com-extension-command.php b/plugins/woocommerce/includes/cli/class-wc-cli-com-extension-command.php
index 58d27b477ac..e80851ccd38 100644
--- a/plugins/woocommerce/includes/cli/class-wc-cli-com-extension-command.php
+++ b/plugins/woocommerce/includes/cli/class-wc-cli-com-extension-command.php
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! class_exists( 'Plugin_Command' ) ) {
- exit;
+ return;
}
/**