diff --git a/plugins/woocommerce/changelog/fix-cli-improvs b/plugins/woocommerce/changelog/fix-cli-improvs new file mode 100644 index 00000000000..ad726ce966b --- /dev/null +++ b/plugins/woocommerce/changelog/fix-cli-improvs @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Remove COT enable requirement from sync and verify command. diff --git a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php index 05ce0c1d2c6..19b551722d0 100644 --- a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php +++ b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php @@ -102,10 +102,6 @@ class CLIRunner { * @return int The number of orders to be migrated.* */ public function count_unmigrated( $args = array(), $assoc_args = array() ) : int { - if ( ! $this->is_enabled() ) { - return 0; - } - // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $order_count = $this->synchronizer->get_current_orders_pending_sync_count(); @@ -152,10 +148,6 @@ class CLIRunner { * @param array $assoc_args Associative arguments (options) passed to the command. */ public function sync( $args = array(), $assoc_args = array() ) { - if ( ! $this->is_enabled() ) { - return; - } - if ( ! $this->synchronizer->check_orders_table_exists() ) { WP_CLI::warning( __( 'Custom order tables does not exist, creating...', 'woocommerce' ) ); $this->synchronizer->create_database_tables(); @@ -324,7 +316,9 @@ class CLIRunner { */ public function verify_cot_data( $args = array(), $assoc_args = array() ) { global $wpdb; - if ( ! $this->is_enabled() ) { + + if ( ! $this->synchronizer->check_orders_table_exists() ) { + WP_CLI::error( __( 'Orders table does not exist.', 'woocommerce' ) ); return; }