Commit 06fa7983d02 for woocommerce

commit 06fa7983d0212beb0cec03189a5d3aa17699ce40
Author: Tung Du <dinhtungdu@gmail.com>
Date:   Tue Aug 25 17:25:32 2026 +0700

    Fix: respect filtered enabled status for customer verification email (#67997)

    * fix: respect verification email enabled filter

    * fix: guard customer verification email lookup

diff --git a/plugins/woocommerce/changelog/fix-wooairr-135-email-filter b/plugins/woocommerce/changelog/fix-wooairr-135-email-filter
new file mode 100644
index 00000000000..e3c0ff49d87
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-wooairr-135-email-filter
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Respect verification email enabled filters when showing the customer email verification prompt.
diff --git a/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php b/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
index 71f7849723a..52302c6669b 100644
--- a/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
+++ b/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
@@ -3,6 +3,8 @@ declare( strict_types=1 );

 namespace Automattic\WooCommerce\Internal\CustomerEmailVerification;

+use WC_Email;
+
 /**
  * Drives the customer email-verification UI on My Account and processes its verify-links.
  *
@@ -224,10 +226,8 @@ class VerificationController {
 			return false;
 		}

-		$email_setting = get_option( 'woocommerce_customer_verify_email_settings', array() );
-		$email_enabled = 'yes' === ( $email_setting['enabled'] ?? 'yes' );
-
-		$should_show = $email_enabled && wc_string_to_bool( get_option( 'woocommerce_enable_guest_checkout' ) );
+		$email       = WC()->mailer()->get_emails()['WC_Email_Customer_Verify_Email'] ?? null;
+		$should_show = $email instanceof WC_Email && $email->is_enabled() && wc_string_to_bool( get_option( 'woocommerce_enable_guest_checkout' ) );

 		// A temporary-password account already has a set-password link (which also verifies on use),
 		// surfaced by the temporary-password notice, so skip a second prompt alongside it.
diff --git a/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php b/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
index 537a74847d3..419baf854e3 100644
--- a/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
@@ -157,17 +157,29 @@ class MyAccountPromptTest extends WC_Unit_Test_Case {
 		$user_id = wc_create_new_customer( 'prompt-email-disabled@example.com', 'promptemaildisabled', 'pw' );
 		wp_set_current_user( $user_id );

-		$option_name    = 'woocommerce_customer_verify_email_settings';
-		$previous_value = get_option( $option_name, null );
-		$email_settings = is_array( $previous_value ) ? $previous_value : array();
-
-		$email_settings['enabled'] = 'no';
-		update_option( $option_name, $email_settings );
+		$email                  = WC()->mailer()->get_emails()['WC_Email_Customer_Verify_Email'];
+		$previous_email_enabled = $email->enabled;
+		$email->enabled         = 'no';

 		try {
 			$this->assertSame( '', $this->render_prompt(), 'The prompt should not render when its email is disabled.' );
 		} finally {
-			$this->restore_option( $option_name, $previous_value );
+			$email->enabled = $previous_email_enabled;
+		}
+	}
+
+	/**
+	 * @testdox should_show_prompt returns false when the verification email is disabled by a filter.
+	 */
+	public function test_should_show_prompt_returns_false_when_verification_email_is_filtered_off(): void {
+		$user_id = wc_create_new_customer( 'prompt-email-filtered@example.com', 'promptemailfiltered', 'pw' );
+		wp_set_current_user( $user_id );
+
+		add_filter( 'woocommerce_email_enabled_customer_verify_email', '__return_false' );
+		try {
+			$this->assertFalse( $this->sut->should_show_prompt(), 'The prompt should not show when its email is disabled.' );
+		} finally {
+			remove_filter( 'woocommerce_email_enabled_customer_verify_email', '__return_false' );
 		}
 	}