Commit 7a54fe06220 for woocommerce

commit 7a54fe06220938ba3ea297bf0728df61b098d65a
Author: Anand Rajaram <anandrajaram21@gmail.com>
Date:   Mon Oct 19 19:00:30 2026 +0530

    Fix order fields in Order Confirmation template editor (#69449)

    * Fix order fields in Order Confirmation template editor

    * Add changelog entry for Order Confirmation editor fix

    * Support private method reflection on PHP 8.0

diff --git a/plugins/woocommerce/changelog/fix-order-confirmation-order-fields b/plugins/woocommerce/changelog/fix-order-confirmation-order-fields
new file mode 100644
index 00000000000..3f400b38544
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-order-confirmation-order-fields
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Show order checkout fields in the Order Confirmation template editor.
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapper.php b/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapper.php
index 94a6d72c2f6..d02346cb410 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapper.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapper.php
@@ -50,7 +50,9 @@ class AdditionalFieldsWrapper extends AbstractOrderConfirmationBlock {
 	 */
 	protected function enqueue_data( array $attributes = [] ) {
 		parent::enqueue_data( $attributes );
-		$this->asset_data_registry->add( 'additionalFields', Package::container()->get( CheckoutFields::class )->get_fields_for_location( 'order' ) );
+		$order_fields = Package::container()->get( CheckoutFields::class )->get_fields_for_location( 'order' );
+		$this->asset_data_registry->add( 'additionalFields', $order_fields );
+		$this->asset_data_registry->add( 'additionalOrderFields', $order_fields );
 		$this->asset_data_registry->add( 'additionalContactFields', Package::container()->get( CheckoutFields::class )->get_fields_for_location( 'contact' ) );
 	}
 }
diff --git a/plugins/woocommerce/tests/php/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapperTest.php b/plugins/woocommerce/tests/php/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapperTest.php
new file mode 100644
index 00000000000..355c30a1fdd
--- /dev/null
+++ b/plugins/woocommerce/tests/php/src/Blocks/BlockTypes/OrderConfirmation/AdditionalFieldsWrapperTest.php
@@ -0,0 +1,62 @@
+<?php
+declare( strict_types = 1 );
+
+namespace Automattic\WooCommerce\Tests\Blocks\BlockTypes\OrderConfirmation;
+
+use Automattic\WooCommerce\Blocks\Assets\Api;
+use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
+use Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation\AdditionalFieldsWrapper;
+use Automattic\WooCommerce\Blocks\Integrations\IntegrationRegistry;
+use Automattic\WooCommerce\Blocks\Package;
+use WC_Unit_Test_Case;
+
+/**
+ * Tests for the additional fields wrapper block.
+ */
+class AdditionalFieldsWrapperTest extends WC_Unit_Test_Case {
+	/**
+	 * Remove the field registered by the test.
+	 */
+	public function tear_down() {
+		__internal_woocommerce_blocks_deregister_checkout_field( 'test/order-confirmation-field' );
+		parent::tear_down();
+	}
+
+	/**
+	 * @testdox Order fields are published under the editor's setting key without removing the legacy key.
+	 */
+	public function test_order_fields_are_available_in_editor_settings(): void {
+		$field_id = 'test/order-confirmation-field';
+		woocommerce_register_additional_checkout_field(
+			[
+				'id'       => $field_id,
+				'label'    => 'Order confirmation field',
+				'location' => 'order',
+			]
+		);
+
+		$registry = Package::container()->get( AssetDataRegistry::class );
+		$block    = new class( Package::container()->get( Api::class ), $registry, new IntegrationRegistry() ) extends AdditionalFieldsWrapper {
+			/**
+			 * Skip registration; only data publishing is under test.
+			 */
+			protected function initialize() {}
+
+			/**
+			 * Publish the editor data.
+			 */
+			public function publish_data(): void {
+				$this->enqueue_data();
+			}
+		};
+		$block->publish_data();
+
+		$get_method = new \ReflectionMethod( AssetDataRegistry::class, 'get' );
+		if ( PHP_VERSION_ID < 80100 ) {
+			$get_method->setAccessible( true );
+		}
+		$data = $get_method->invoke( $registry );
+		$this->assertArrayHasKey( $field_id, $data['additionalOrderFields'], 'Order fields must reach the editor.' );
+		$this->assertSame( $data['additionalFields'], $data['additionalOrderFields'], 'The existing setting must remain available.' );
+	}
+}