Commit 27bc0d7c233 for woocommerce

commit 27bc0d7c233e40aa2943d4eb1c6df40c5bc05b43
Author: agent-sandbox-woocommerce[bot] <282076412+agent-sandbox-woocommerce[bot]@users.noreply.github.com>
Date:   Tue Oct 27 12:34:54 2026 +0000

    Fix orders API search E2E test: handle substring match and await order creation (#70285)

diff --git a/plugins/woocommerce/changelog/fxlt-43-orders-api-search-test b/plugins/woocommerce/changelog/fxlt-43-orders-api-search-test
new file mode 100644
index 00000000000..a23bf849ca7
--- /dev/null
+++ b/plugins/woocommerce/changelog/fxlt-43-orders-api-search-test
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Fix the orders API "List all orders > search" E2E test to handle substring matching and properly await order creation; no production change.
diff --git a/plugins/woocommerce/tests/e2e/tests/api-tests/orders/orders.test.ts b/plugins/woocommerce/tests/e2e/tests/api-tests/orders/orders.test.ts
index 55d025d758a..32205249f08 100644
--- a/plugins/woocommerce/tests/e2e/tests/api-tests/orders/orders.test.ts
+++ b/plugins/woocommerce/tests/e2e/tests/api-tests/orders/orders.test.ts
@@ -2247,7 +2247,7 @@ test.describe.serial( 'Orders API tests', () => {

 			const orders = [];
 			// Have "John" order all products.
-			Object.values( orderedProducts ).forEach( async ( product ) => {
+			for ( const product of Object.values( orderedProducts ) ) {
 				const order2 = await request.post( './wp-json/wc/v3/orders', {
 					data: {
 						...orderBaseData,
@@ -2269,7 +2269,7 @@ test.describe.serial( 'Orders API tests', () => {
 				const orderJSON = await order2.json();

 				orders.push( orderJSON );
-			} );
+			}

 			// Have "Tina" order some sunglasses and make a child order.
 			// This somewhat resembles a subscription renewal, but we're just testing the `parent` field.
@@ -3080,14 +3080,18 @@ test.describe.serial( 'Orders API tests', () => {
 			const result4 = await request.get( './wp-json/wc/v3/orders', {
 				params: {
 					search: 'Doe',
+					per_page: 100,
 				},
 			} );
 			const result4JSON = await result4.json();

 			expect( result4.status() ).toEqual( 200 );
 			expect( result4JSON.length ).toBeGreaterThanOrEqual( 1 );
+			expect( result4JSON.map( ( { id } ) => id ) ).toContain(
+				sampleData.orders[ 0 ].id
+			);
 			result4JSON.forEach( ( _order ) =>
-				expect( _order.billing.last_name ).toEqual( 'Doe' )
+				expect( _order.billing.last_name ).toContain( 'Doe' )
 			);

 			// Test order item name.