Commit 408677b89b2 for woocommerce
commit 408677b89b2dbdfbcea604ae6b92295643950cb0
Author: Tung Du <dinhtungdu@gmail.com>
Date: Tue Aug 25 14:22:57 2026 +0700
Fix: Hide email verification prompt when the notification email is disabled (#67993)
* fix: hide disabled verification email prompt
* chore: add verification email changelog
diff --git a/plugins/woocommerce/changelog/67879-fix-disabled-verification-email b/plugins/woocommerce/changelog/67879-fix-disabled-verification-email
new file mode 100644
index 00000000000..dec44e6267c
--- /dev/null
+++ b/plugins/woocommerce/changelog/67879-fix-disabled-verification-email
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Hide the customer email verification prompt when its email notification is disabled.
diff --git a/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php b/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
index 1d2e4b97408..71f7849723a 100644
--- a/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
+++ b/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
@@ -224,7 +224,10 @@ class VerificationController {
return false;
}
- $should_show = wc_string_to_bool( get_option( 'woocommerce_enable_guest_checkout' ) );
+ $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' ) );
// 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 7838c0a440f..537a74847d3 100644
--- a/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
@@ -150,6 +150,27 @@ class MyAccountPromptTest extends WC_Unit_Test_Case {
$this->assertFalse( $this->sut->should_show_prompt(), 'The prompt should not show when guest checkout is disabled.' );
}
+ /**
+ * @testdox The prompt does not render when the verification email is disabled.
+ */
+ public function test_prompt_does_not_render_when_verification_email_is_disabled(): void {
+ $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 );
+
+ try {
+ $this->assertSame( '', $this->render_prompt(), 'The prompt should not render when its email is disabled.' );
+ } finally {
+ $this->restore_option( $option_name, $previous_value );
+ }
+ }
+
/**
* @testdox should_show_prompt allows filters to override the guest checkout default.
*/