Commit 81d3e418656 for woocommerce

commit 81d3e418656bf805f2af0fb0c96a16e5df80f689
Author: Ján Mikláš <neosinner@gmail.com>
Date:   Thu Jun 4 18:06:03 2026 +0200

    Show reply-to email settings without block editor (#65122)

    * Show reply-to email settings without block editor

    * Add changelog entry for always-visible Reply-to settings

    * Restore email feature flag after test

    * Assert email_options group structure instead of skipping checks

    The reply-to field checks were wrapped in an isset() guard, so the test
    would silently pass if the email_options group or its fields were missing.
    Assert both keys exist before checking the reply-to fields.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---------

    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

diff --git a/plugins/woocommerce/changelog/wooplug-6536-email-reply-to-always-visible b/plugins/woocommerce/changelog/wooplug-6536-email-reply-to-always-visible
new file mode 100644
index 00000000000..d69a3d4639b
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-6536-email-reply-to-always-visible
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Always show the email Reply-to settings, regardless of whether the email block editor feature is enabled.
diff --git a/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php b/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php
index 24c763e430f..c62bb12282a 100644
--- a/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php
+++ b/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php
@@ -151,44 +151,42 @@ class WC_Settings_Emails extends WC_Settings_Page {
 				),
 			);

-		// Add reply-to fields when block email editor is enabled.
-		if ( $block_email_editor_enabled ) {
-			$settings = array_merge(
-				$settings,
+		// Add reply-to fields.
+		$settings = array_merge(
+			$settings,
+			array(
 				array(
-					array(
-						'title'    => __( 'Add "Reply-to" email', 'woocommerce' ),
-						'desc'     => __( 'Add a different email address to receive replies.', 'woocommerce' ),
-						'id'       => 'woocommerce_email_reply_to_enabled',
-						'type'     => 'checkbox',
-						'default'  => 'no',
-						'autoload' => false,
-					),
+					'title'    => __( 'Add "Reply-to" email', 'woocommerce' ),
+					'desc'     => __( 'Add a different email address to receive replies.', 'woocommerce' ),
+					'id'       => 'woocommerce_email_reply_to_enabled',
+					'type'     => 'checkbox',
+					'default'  => 'no',
+					'autoload' => false,
+				),

-					array(
-						'title'    => __( '"Reply-to" name', 'woocommerce' ),
-						'desc'     => '',
-						'id'       => 'woocommerce_email_reply_to_name',
-						'type'     => 'text',
-						'css'      => 'min-width:400px;',
-						'default'  => '',
-						'autoload' => false,
-						'desc_tip' => true,
-					),
+				array(
+					'title'    => __( '"Reply-to" name', 'woocommerce' ),
+					'desc'     => '',
+					'id'       => 'woocommerce_email_reply_to_name',
+					'type'     => 'text',
+					'css'      => 'min-width:400px;',
+					'default'  => '',
+					'autoload' => false,
+					'desc_tip' => true,
+				),

-					array(
-						'title'    => __( '"Reply-to" address', 'woocommerce' ),
-						'desc'     => '',
-						'id'       => 'woocommerce_email_reply_to_address',
-						'type'     => 'email',
-						'css'      => 'min-width:400px;',
-						'default'  => '',
-						'autoload' => false,
-						'desc_tip' => true,
-					),
-				)
-			);
-		}
+				array(
+					'title'    => __( '"Reply-to" address', 'woocommerce' ),
+					'desc'     => '',
+					'id'       => 'woocommerce_email_reply_to_address',
+					'type'     => 'email',
+					'css'      => 'min-width:400px;',
+					'default'  => '',
+					'autoload' => false,
+					'desc_tip' => true,
+				),
+			)
+		);

 		$settings = array_merge(
 			$settings,
diff --git a/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-emails-test.php b/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-emails-test.php
index 5efb69dd243..72feaa15ec2 100644
--- a/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-emails-test.php
+++ b/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-emails-test.php
@@ -75,6 +75,9 @@ class WC_Settings_Emails_Test extends WC_Settings_Unit_Test_Case {
 			'email_options'                           => array( 'title', 'sectionend' ),
 			'woocommerce_email_from_name'             => 'text',
 			'woocommerce_email_from_address'          => 'email',
+			'woocommerce_email_reply_to_enabled'      => 'checkbox',
+			'woocommerce_email_reply_to_name'         => 'text',
+			'woocommerce_email_reply_to_address'      => 'email',
 			'email_template_options'                  => array( 'title', 'sectionend' ),
 			'previewing_new_templates'                => 'previewing_new_templates',
 			'woocommerce_email_header_image'          => 'email_image_url',
@@ -99,25 +102,32 @@ class WC_Settings_Emails_Test extends WC_Settings_Unit_Test_Case {
 	 * @testdox get_settings('') should return reply-to settings when block email editor is enabled.
 	 */
 	public function test_get_default_settings_with_block_email_editor_enabled() {
-		// Enable block email editor feature before any WooCommerce initialization.
-		update_option( 'woocommerce_feature_block_email_editor_enabled', 'yes' );
-
-		$sut                   = new WC_Settings_Emails();
-		$settings              = $sut->get_settings_for_section( '' );
-		$setting_ids_and_types = $this->get_ids_and_types( $settings );
-
-		// Verify reply-to fields are present.
-		$this->assertArrayHasKey( 'woocommerce_email_reply_to_enabled', $setting_ids_and_types );
-		$this->assertEquals( 'checkbox', $setting_ids_and_types['woocommerce_email_reply_to_enabled'] );
-
-		$this->assertArrayHasKey( 'woocommerce_email_reply_to_name', $setting_ids_and_types );
-		$this->assertEquals( 'text', $setting_ids_and_types['woocommerce_email_reply_to_name'] );
-
-		$this->assertArrayHasKey( 'woocommerce_email_reply_to_address', $setting_ids_and_types );
-		$this->assertEquals( 'email', $setting_ids_and_types['woocommerce_email_reply_to_address'] );
-
-		// Clean up.
-		update_option( 'woocommerce_feature_block_email_editor_enabled', 'no' );
+		$previous_value = get_option( 'woocommerce_feature_block_email_editor_enabled', null );
+
+		try {
+			// Enable block email editor feature before any WooCommerce initialization.
+			update_option( 'woocommerce_feature_block_email_editor_enabled', 'yes' );
+
+			$sut                   = new WC_Settings_Emails();
+			$settings              = $sut->get_settings_for_section( '' );
+			$setting_ids_and_types = $this->get_ids_and_types( $settings );
+
+			// Verify reply-to fields are present.
+			$this->assertArrayHasKey( 'woocommerce_email_reply_to_enabled', $setting_ids_and_types );
+			$this->assertEquals( 'checkbox', $setting_ids_and_types['woocommerce_email_reply_to_enabled'] );
+
+			$this->assertArrayHasKey( 'woocommerce_email_reply_to_name', $setting_ids_and_types );
+			$this->assertEquals( 'text', $setting_ids_and_types['woocommerce_email_reply_to_name'] );
+
+			$this->assertArrayHasKey( 'woocommerce_email_reply_to_address', $setting_ids_and_types );
+			$this->assertEquals( 'email', $setting_ids_and_types['woocommerce_email_reply_to_address'] );
+		} finally {
+			if ( null === $previous_value ) {
+				delete_option( 'woocommerce_feature_block_email_editor_enabled' );
+			} else {
+				update_option( 'woocommerce_feature_block_email_editor_enabled', $previous_value );
+			}
+		}
 	}

 	/**
diff --git a/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Settings/Email/EmailSettingsControllerTest.php b/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Settings/Email/EmailSettingsControllerTest.php
index b0dd173800f..04a4c29d638 100644
--- a/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Settings/Email/EmailSettingsControllerTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/RestApi/Routes/V4/Settings/Email/EmailSettingsControllerTest.php
@@ -158,7 +158,7 @@ class EmailSettingsControllerTest extends WC_REST_Unit_Test_Case {

 	/**
 	 * Test getting email settings when block email editor is disabled.
-	 * Reply-to fields should not be present, but design fields should be present.
+	 * Reply-to and design fields should be present.
 	 */
 	public function test_get_item_without_block_email_editor() {
 		// Disable block email editor feature.
@@ -180,10 +180,10 @@ class EmailSettingsControllerTest extends WC_REST_Unit_Test_Case {
 		$this->assertArrayHasKey( 'woocommerce_email_from_name', $data['values'] );
 		$this->assertArrayHasKey( 'woocommerce_email_from_address', $data['values'] );

-		// Reply-to fields should NOT be present when block email editor is disabled.
-		$this->assertArrayNotHasKey( 'woocommerce_email_reply_to_enabled', $data['values'] );
-		$this->assertArrayNotHasKey( 'woocommerce_email_reply_to_name', $data['values'] );
-		$this->assertArrayNotHasKey( 'woocommerce_email_reply_to_address', $data['values'] );
+		// Reply-to fields should be present when block email editor is disabled.
+		$this->assertArrayHasKey( 'woocommerce_email_reply_to_enabled', $data['values'] );
+		$this->assertArrayHasKey( 'woocommerce_email_reply_to_name', $data['values'] );
+		$this->assertArrayHasKey( 'woocommerce_email_reply_to_address', $data['values'] );

 		// Design fields SHOULD be present when block email editor is disabled.
 		$this->assertArrayHasKey( 'woocommerce_email_header_image', $data['values'] );
@@ -197,15 +197,15 @@ class EmailSettingsControllerTest extends WC_REST_Unit_Test_Case {
 		$this->assertArrayHasKey( 'woocommerce_email_text_color', $data['values'] );
 		$this->assertArrayHasKey( 'woocommerce_email_footer_text_color', $data['values'] );

-		// Verify the email_options group exists and does not contain reply-to fields.
-		if ( isset( $data['groups']['email_options'] ) && isset( $data['groups']['email_options']['fields'] ) ) {
-			$field_ids = array_column( $data['groups']['email_options']['fields'], 'id' );
-			$this->assertContains( 'woocommerce_email_from_name', $field_ids );
-			$this->assertContains( 'woocommerce_email_from_address', $field_ids );
-			$this->assertNotContains( 'woocommerce_email_reply_to_enabled', $field_ids );
-			$this->assertNotContains( 'woocommerce_email_reply_to_name', $field_ids );
-			$this->assertNotContains( 'woocommerce_email_reply_to_address', $field_ids );
-		}
+		// Verify the email_options group exists and contains reply-to fields.
+		$this->assertArrayHasKey( 'email_options', $data['groups'] );
+		$this->assertArrayHasKey( 'fields', $data['groups']['email_options'] );
+		$field_ids = array_column( $data['groups']['email_options']['fields'], 'id' );
+		$this->assertContains( 'woocommerce_email_from_name', $field_ids );
+		$this->assertContains( 'woocommerce_email_from_address', $field_ids );
+		$this->assertContains( 'woocommerce_email_reply_to_enabled', $field_ids );
+		$this->assertContains( 'woocommerce_email_reply_to_name', $field_ids );
+		$this->assertContains( 'woocommerce_email_reply_to_address', $field_ids );

 		// Verify email template options group exists with design fields.
 		$this->assertArrayHasKey( 'email_template_options', $data['groups'] );