Commit 99178936d78 for woocommerce

commit 99178936d780a01a5415d905a60244016cceb823
Author: Ricardo Sawir <37329575+sawirricardo@users.noreply.github.com>
Date:   Thu Jun 18 13:14:05 2026 +0700

    Add 'wc' debug group to WP_CLI::debug calls in CLIRunner (#65701)

    * Add 'wc' debug group to WP_CLI::debug calls in CLIRunner

    All WP_CLI::debug calls in CLIRunner.php were missing a debug group,
    causing noisy output when using --debug without a group filter. Added
    the 'wc' group to all 5 calls for consistency with other WC CLI commands.

    Usage: wp wc hpos cleanup <order_id> --debug=wc

    Fixes #46855

    * Update MockWPCLI::debug() to accept optional $group parameter

    Matches the WP_CLI::debug( $message, $group ) signature so that
    calls from CLIRunner passing 'wc' as the debug group work without
    errors. Behavior otherwise identical.

    * Fix MockWPCLI debug group docs

    * Add changelog entry for CLI debug group

diff --git a/plugins/woocommerce/changelog/65701-add-wc-cli-debug-group b/plugins/woocommerce/changelog/65701-add-wc-cli-debug-group
new file mode 100644
index 00000000000..68636367e79
--- /dev/null
+++ b/plugins/woocommerce/changelog/65701-add-wc-cli-debug-group
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Add the WooCommerce debug group to HPOS CLI debug messages.
diff --git a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php
index 6d9a02fa21a..5675d943833 100644
--- a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php
+++ b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php
@@ -218,7 +218,8 @@ class CLIRunner {
 					__( 'Beginning batch #%1$d (%2$d orders/batch).', 'woocommerce' ),
 					$batch_count,
 					$batch_size
-				)
+				),
+				'wc'
 			);
 			$batch_start_time = microtime( true );
 			$order_ids        = $this->synchronizer->get_next_batch_to_process( $batch_size );
@@ -235,7 +236,8 @@ class CLIRunner {
 					$batch_count,
 					count( $order_ids ),
 					$batch_total_time
-				)
+				),
+				'wc'
 			);

 			++$batch_count;
@@ -411,7 +413,8 @@ class CLIRunner {
 					__( 'Beginning verification for batch #%1$d (%2$d orders/batch).', 'woocommerce' ),
 					$batch_count,
 					$batch_size
-				)
+				),
+				'wc'
 			);

 			// phpcs:disable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Inputs are prepared.
@@ -510,7 +513,8 @@ class CLIRunner {
 					$batch_count,
 					count( $order_ids ),
 					$batch_total_time
-				)
+				),
+				'wc'
 			);

 			$order_id_start  = max( $order_ids ) + 1;
@@ -980,7 +984,7 @@ ORDER BY $meta_table.order_id ASC, $meta_table.meta_key ASC;
 					++$count;

 					// translators: %d is an order ID.
-					WP_CLI::debug( sprintf( __( 'Cleanup completed for order %d.', 'woocommerce' ), $order_id ) );
+					WP_CLI::debug( sprintf( __( 'Cleanup completed for order %d.', 'woocommerce' ), $order_id ), 'wc' );
 				} catch ( \Exception $e ) {
 					// translators: %1$d is an order ID, %2$s is an error message.
 					WP_CLI::warning( sprintf( __( 'An error occurred while cleaning up order %1$d: %2$s', 'woocommerce' ), $order_id, $e->getMessage() ) );
diff --git a/plugins/woocommerce/tests/php/src/Internal/CLI/Migrator/Mocks/MockWPCLI.php b/plugins/woocommerce/tests/php/src/Internal/CLI/Migrator/Mocks/MockWPCLI.php
index 077b2733dbe..0c5f7cf8961 100644
--- a/plugins/woocommerce/tests/php/src/Internal/CLI/Migrator/Mocks/MockWPCLI.php
+++ b/plugins/woocommerce/tests/php/src/Internal/CLI/Migrator/Mocks/MockWPCLI.php
@@ -72,9 +72,10 @@ class MockWPCLI {
 	/**
 	 * Mock debug method.
 	 *
-	 * @param string $message Debug message.
+	 * @param string      $message Debug message.
+	 * @param string|bool $group   Debug group.
 	 */
-	public static function debug( $message ): void {
+	public static function debug( $message, $group = false ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
 		self::$last_debug_message = $message;
 	}