Commit 9d3d1e68c62 for woocommerce

commit 9d3d1e68c624bfc45c3cba16864040ce362af72f
Author: Vijay Misal <misalvijay153@gmail.com>
Date:   Wed Oct 14 23:38:34 2026 +0530

    Fix email review drawer claiming structural changes were applied (#69340)

    * Fix review drawer claiming structural changes were applied (#68897)

    The selective applier never applies structural_changes entries, but the
    review drawer badged every one "Apply core" with the caption "Structural
    change applied automatically." Show them as "Keep yours" with wording
    that matches what happens: merchant_removed keeps the merchant's removal,
    and nest/reorder entries say this update does not apply structural
    changes.

    * Use neutral caption for structural differences in review drawer

    Structural entries can come from the merchant's own edits, so describe
    them as differing from core rather than as core changes. Also apply
    Prettier formatting.

diff --git a/plugins/woocommerce/changelog/68897-fix-email-review-structural-changes b/plugins/woocommerce/changelog/68897-fix-email-review-structural-changes
new file mode 100644
index 00000000000..6b95cb1326b
--- /dev/null
+++ b/plugins/woocommerce/changelog/68897-fix-email-review-structural-changes
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Stop the email template update review from saying structural changes were applied automatically, since they are never applied.
diff --git a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/__tests__/review-drawer.test.tsx b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/__tests__/review-drawer.test.tsx
index d7f3b002c8b..633149f7627 100644
--- a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/__tests__/review-drawer.test.tsx
+++ b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/__tests__/review-drawer.test.tsx
@@ -169,4 +169,68 @@ describe( 'ReviewDrawer', () => {
 		await apply.mock.results[ 0 ].value;
 		expect( onOpenChange ).not.toHaveBeenCalled();
 	} );
+
+	it( 'does not claim structural changes were applied', () => {
+		mockUseChangeSummary.mockReturnValue( {
+			summary: {
+				...summary,
+				copy_changes: [],
+				structural_changes: [
+					{
+						kind: 'merchant_removed',
+						description:
+							'You removed Paragraph; core still has it.',
+						path: [ 1 ],
+					},
+					{
+						kind: 'nest',
+						description: 'Added Group wrapper',
+						path: [ 0 ],
+					},
+					{
+						kind: 'reorder',
+						description: 'Reordered Heading',
+					},
+				],
+			},
+			isLoading: false,
+			error: null,
+			refetch: jest.fn(),
+		} );
+		mockUseApplyUpdate.mockReturnValue( {
+			apply: jest.fn(),
+			isApplying: false,
+		} );
+
+		render(
+			<ReviewDrawer
+				postId={ 123 }
+				emailTitle="New order"
+				isOpen
+				onOpenChange={ jest.fn() }
+			/>
+		);
+
+		expect(
+			screen.queryByText( 'Structural change applied automatically.' )
+		).not.toBeInTheDocument();
+		expect( screen.queryByText( 'Apply core' ) ).not.toBeInTheDocument();
+		expect( screen.getAllByText( 'Keep yours' ) ).toHaveLength( 3 );
+
+		const getItem = ( title: string ) =>
+			screen
+				.getByText( title )
+				.closest( '.woocommerce-review-drawer__item' );
+
+		expect(
+			getItem( 'You removed Paragraph; core still has it.' )
+		).toHaveTextContent(
+			'Core still has this block. Your removal is kept.'
+		);
+		for ( const title of [ 'Added Group wrapper', 'Reordered Heading' ] ) {
+			expect( getItem( title ) ).toHaveTextContent(
+				'The block structure differs from core here. This update does not apply structural changes.'
+			);
+		}
+	} );
 } );
diff --git a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/hooks/use-change-summary.ts b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/hooks/use-change-summary.ts
index 59b365fe834..26f84af68cc 100644
--- a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/hooks/use-change-summary.ts
+++ b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/hooks/use-change-summary.ts
@@ -45,7 +45,7 @@ export interface ChangeSummaryCopyChange {
  * Shape of a single structural-change entry.
  */
 export interface ChangeSummaryStructuralChange {
-	/** `nest` or `reorder`. */
+	/** `nest`, `reorder`, or `merchant_removed`. */
 	kind: string;
 	/** Pre-localized one-line description. */
 	description: string;
diff --git a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/review-drawer.tsx b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/review-drawer.tsx
index 4ca2494d1c8..b965a62e8f4 100644
--- a/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/review-drawer.tsx
+++ b/plugins/woocommerce/client/admin/client/wp-admin-scripts/email-editor-integration/review-drawer.tsx
@@ -313,16 +313,24 @@ const AutoResolvedGroup = ( {
 					tag="keep_yours"
 				/>
 			) ) }
+			{ /* The selective applier never applies structural changes, so every entry keeps the merchant's version. */ }
 			{ summary.structural_changes.map(
 				( change: ChangeSummaryStructuralChange, idx: number ) => (
 					<AutoResolvedItem
 						key={ `structural-${ idx }` }
 						title={ change.description }
-						sub={ __(
-							'Structural change applied automatically.',
-							'woocommerce'
-						) }
-						tag="apply_core"
+						sub={
+							change.kind === 'merchant_removed'
+								? __(
+										'Core still has this block. Your removal is kept.',
+										'woocommerce'
+									)
+								: __(
+										'The block structure differs from core here. This update does not apply structural changes.',
+										'woocommerce'
+									)
+						}
+						tag="keep_yours"
 					/>
 				)
 			) }