Commit 5fca5717b04 for woocommerce

commit 5fca5717b04f164d69eb4e03f8fa0c7fd8712429
Author: Daniel Mallory <daniel.mallory@automattic.com>
Date:   Thu Oct 1 12:33:53 2026 +0100

    Fix Shop page field breaking the experimental Settings UI (#69256)

    fix(settings): map searchable page selectors in the Settings UI schema

    The Shop page setting now uses `single_select_page_with_search` on the
    classic screen, but SettingsUISchema only mapped `single_select_page`.
    With the settings-ui flag on, the field reached the client with an
    unknown type, its control threw, and Products > General showed the
    error notice instead of the form.

    Map the searchable type to `select` and build its page options the same
    way as `single_select_page`. The Settings UI loads the full page list,
    as it did before the classic screen switched to on-demand search.

    Refs WOOAIRR-432

    Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/plugins/woocommerce/changelog/fix-WOOAIRR-432-settings-ui-page-search b/plugins/woocommerce/changelog/fix-WOOAIRR-432-settings-ui-page-search
new file mode 100644
index 00000000000..202891d3cbc
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-WOOAIRR-432-settings-ui-page-search
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+Comment: Fix Shop page picker in the unreleased experimental Settings UI; no change for merchants.
+
diff --git a/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php b/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php
index d96ca978409..b3cc9097194 100644
--- a/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php
+++ b/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php
@@ -1533,10 +1533,11 @@ class SettingsUISchema {
 	 */
 	private static function normalize_type( string $type ): string {
 		$type_map = array(
-			'multiselect'            => 'array',
-			'multi_select_countries' => 'array',
-			'single_select_country'  => 'select',
-			'single_select_page'     => 'select',
+			'multiselect'                    => 'array',
+			'multi_select_countries'         => 'array',
+			'single_select_country'          => 'select',
+			'single_select_page'             => 'select',
+			'single_select_page_with_search' => 'select',
 		);

 		return $type_map[ $type ] ?? $type;
@@ -1641,7 +1642,7 @@ class SettingsUISchema {
 	private static function get_options( array $setting ): array {
 		$type = isset( $setting['type'] ) && is_string( $setting['type'] ) ? $setting['type'] : '';

-		if ( 'single_select_page' === $type ) {
+		if ( in_array( $type, array( 'single_select_page', 'single_select_page_with_search' ), true ) ) {
 			return self::get_page_options( $setting );
 		}

diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/SettingsUISchemaTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/SettingsUISchemaTest.php
index 906411e3ea1..25ce4a0120e 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/SettingsUISchemaTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/SettingsUISchemaTest.php
@@ -281,9 +281,14 @@ class SettingsUISchemaTest extends WC_Unit_Test_Case {
 	}

 	/**
-	 * @testdox It builds options for legacy page selectors that do not declare options.
+	 * @testdox It builds options for legacy $type page selectors that do not declare options.
+	 *
+	 * @testWith ["single_select_page"]
+	 *           ["single_select_page_with_search"]
+	 *
+	 * @param string $type Legacy page selector type.
 	 */
-	public function test_from_legacy_settings_builds_page_options(): void {
+	public function test_from_legacy_settings_builds_page_options( string $type ): void {
 		$page_id = self::factory()->post->create(
 			array(
 				'post_type'   => 'page',
@@ -300,7 +305,7 @@ class SettingsUISchemaTest extends WC_Unit_Test_Case {
 				array(
 					'id'    => 'acme_page',
 					'label' => 'Acme page',
-					'type'  => 'single_select_page',
+					'type'  => $type,
 					'value' => (string) $page_id,
 				),
 			)