Commit 70e4b16a48e for woocommerce

commit 70e4b16a48e47233ab237a968c952b14bb4be5cf
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Tue Aug 25 09:48:58 2026 -0400

    Exclude payment settings from Blueprint exports (#67941)

diff --git a/plugins/woocommerce/changelog/fix-blueprint-exclude-payment-settings b/plugins/woocommerce/changelog/fix-blueprint-exclude-payment-settings
new file mode 100644
index 00000000000..6091614e365
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-blueprint-exclude-payment-settings
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Exclude payment settings from Blueprint exports and clarify this in the export interface.
diff --git a/plugins/woocommerce/client/admin/client/blueprint/settings/slotfill.js b/plugins/woocommerce/client/admin/client/blueprint/settings/slotfill.js
index eaa33dd77ba..675bc8d1c69 100644
--- a/plugins/woocommerce/client/admin/client/blueprint/settings/slotfill.js
+++ b/plugins/woocommerce/client/admin/client/blueprint/settings/slotfill.js
@@ -188,7 +188,7 @@ const Blueprint = () => {
 			<h4>{ __( 'Export', 'woocommerce' ) }</h4>
 			<p className="blueprint-settings-export-intro">
 				{ __(
-					'Select the settings, plugins, and themes to export as a .json file.',
+					'Select the settings, plugins, and themes to export as a .json file. Payment settings are not exported and must be configured manually after import.',
 					'woocommerce'
 				) }
 			</p>
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 57a84f5f571..09a27a50971 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -45297,12 +45297,6 @@ parameters:
 			count: 1
 			path: src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php

-		-
-			message: '#^Argument of an invalid type string supplied for foreach, only iterables are supported\.$#'
-			identifier: foreach.nonIterable
-			count: 1
-			path: src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php
-
 		-
 			message: '#^Property WooCommerce\:\:\$integrations \(WC_Integrations\) in isset\(\) is not nullable\.$#'
 			identifier: isset.property
diff --git a/plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php b/plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php
index a1aad545f0d..fec5bc3f180 100644
--- a/plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php
+++ b/plugins/woocommerce/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGateways.php
@@ -9,7 +9,9 @@ use Automattic\WooCommerce\Blueprint\Steps\SetSiteOptions;
 use Automattic\WooCommerce\Blueprint\Steps\Step;

 /**
- * ExportWCPaymentGateways class
+ * Legacy payment gateways exporter.
+ *
+ * @deprecated 11.2.0 Payment settings are no longer included in Blueprint exports.
  */
 class ExportWCPaymentGateways implements StepExporter {
 	/**
@@ -25,17 +27,7 @@ class ExportWCPaymentGateways implements StepExporter {
 	 * @return Step
 	 */
 	public function export(): Step {
-		$options = array();
-		$this->maybe_hide_wcpay_gateways();
-		foreach ( $this->get_wc_payment_gateways() as $id => $payment_gateway ) {
-			if ( in_array( $id, $this->exclude_ids, true ) ) {
-				continue;
-			}
-
-			$options[ 'woocommerce_' . $id . '_settings' ] = $payment_gateway->settings;
-		}
-
-		return new SetSiteOptions( $options );
+		return new SetSiteOptions();
 	}

 	/**
@@ -82,7 +74,7 @@ class ExportWCPaymentGateways implements StepExporter {
 	 * @return string
 	 */
 	public function get_description() {
-		return __( 'Includes all settings in WooCommerce | Settings | Payments.', 'woocommerce' );
+		return __( 'Payment settings are not included in Blueprint exports.', 'woocommerce' );
 	}


diff --git a/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php b/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php
index 48f8718090e..34eece240c4 100644
--- a/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php
+++ b/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php
@@ -4,7 +4,6 @@ declare( strict_types = 1 );

 namespace Automattic\WooCommerce\Admin\Features\Blueprint;

-use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCPaymentGateways;
 use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCSettingsAccount;
 use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCSettingsAdvanced;
 use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCSettingsEmails;
@@ -80,7 +79,6 @@ class Init {
 			ExportWCSettingsProducts::class,
 			ExportWCSettingsTax::class,
 			ExportWCSettingsShipping::class,
-			ExportWCPaymentGateways::class,
 			ExportWCSettingsAccount::class,
 			ExportWCSettingsEmails::class,
 			ExportWCSettingsIntegrations::class,
@@ -197,7 +195,7 @@ class Init {
 		return array(
 			array(
 				'id'          => 'settings',
-				'description' => __( 'Includes all the items featured in WooCommerce | Settings.', 'woocommerce' ),
+				'description' => __( 'Includes WooCommerce settings except payment settings, which must be configured manually after import.', 'woocommerce' ),
 				'label'       => __( 'WooCommerce Settings', 'woocommerce' ),
 				'icon'        => 'settings',
 				'items'       => array_map(
diff --git a/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGatewaysTest.php b/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGatewaysTest.php
new file mode 100644
index 00000000000..a6d89829d50
--- /dev/null
+++ b/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/Exporters/ExportWCPaymentGatewaysTest.php
@@ -0,0 +1,54 @@
+<?php
+
+declare( strict_types = 1 );
+
+namespace Automattic\WooCommerce\Tests\Admin\Features\Blueprint\Exporters;
+
+use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCPaymentGateways;
+use WC_Unit_Test_Case;
+
+/**
+ * Tests for the legacy payment gateways Blueprint exporter.
+ */
+class ExportWCPaymentGatewaysTest extends WC_Unit_Test_Case {
+	/**
+	 * The System Under Test.
+	 *
+	 * @var ExportWCPaymentGateways
+	 */
+	private $sut;
+
+	/**
+	 * Set up test fixtures.
+	 */
+	public function setUp(): void {
+		parent::setUp();
+
+		$this->sut = new class() extends ExportWCPaymentGateways {
+			/**
+			 * Return a gateway containing representative settings.
+			 *
+			 * @return array
+			 */
+			public function get_wc_payment_gateways() {
+				return array(
+					'example' => (object) array(
+						'settings' => array(
+							'enabled' => 'yes',
+							'title'   => 'Example gateway',
+						),
+					),
+				);
+			}
+		};
+	}
+
+	/**
+	 * @testdox Should not export payment settings.
+	 */
+	public function test_export_returns_empty_options(): void {
+		$export = $this->sut->export()->prepare_json_array();
+
+		$this->assertEquals( (object) array(), $export['options'], 'Payment settings should not be included in Blueprint exports.' );
+	}
+}
diff --git a/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/InitTest.php b/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/InitTest.php
index 8a82bb3d92e..e0379254f09 100644
--- a/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/InitTest.php
+++ b/plugins/woocommerce/tests/php/src/Admin/Features/Blueprint/InitTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);

 namespace Automattic\WooCommerce\Tests\Admin\Features\Blueprint;

+use Automattic\WooCommerce\Admin\Features\Blueprint\Exporters\ExportWCPaymentGateways;
 use Automattic\WooCommerce\Admin\Features\Blueprint\Init;
 use Automattic\WooCommerce\Tests\Admin\Features\Blueprint\Stubs\DummyExporter;
 use Automattic\WooCommerce\Tests\Admin\Features\Blueprint\Stubs\ThemeStub;
@@ -204,7 +205,7 @@ class InitTest extends MockeryTestCase {
 		$expected = array(
 			array(
 				'id'          => 'settings',
-				'description' => 'Includes all the items featured in WooCommerce | Settings.',
+				'description' => 'Includes WooCommerce settings except payment settings, which must be configured manually after import.',
 				'label'       => 'WooCommerce Settings',
 				'icon'        => 'settings',
 				'items'       => array(
@@ -235,6 +236,15 @@ class InitTest extends MockeryTestCase {
 		$this->assertSame( $expected, $result );
 	}

+	/**
+	 * @testdox Should not register payment settings for Blueprint export.
+	 */
+	public function test_get_woo_exporters_excludes_payment_settings(): void {
+		$exporter_classes = array_map( 'get_class', $this->init->get_woo_exporters() );
+
+		$this->assertNotContains( ExportWCPaymentGateways::class, $exporter_classes, 'Payment settings must not be available as a Blueprint export step.' );
+	}
+
 	/**
 	 * Helper method to create a WP_Theme-like object.
 	 *