Commit 88315e1a4e0 for woocommerce
commit 88315e1a4e05afe0f647e45396f81fb224e33f37
Author: Tung Du <dinhtungdu@gmail.com>
Date: Tue Aug 25 21:39:28 2026 +0700
Revert #67997 (#68012)
Revert "Fix: respect filtered enabled status for customer verification email (#67997)"
This reverts commit 06fa7983d0212beb0cec03189a5d3aa17699ce40, reversing changes made to 7a8252acfc067a783027979df824c830dcda4feb.
diff --git a/plugins/woocommerce/changelog/fix-wooairr-135-email-filter b/plugins/woocommerce/changelog/fix-wooairr-135-email-filter
deleted file mode 100644
index e3c0ff49d87..00000000000
--- a/plugins/woocommerce/changelog/fix-wooairr-135-email-filter
+++ /dev/null
@@ -1,4 +0,0 @@
-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 52302c6669b..71f7849723a 100644
--- a/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
+++ b/plugins/woocommerce/src/Internal/CustomerEmailVerification/VerificationController.php
@@ -3,8 +3,6 @@ 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.
*
@@ -226,8 +224,10 @@ class VerificationController {
return false;
}
- $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' ) );
+ $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 419baf854e3..537a74847d3 100644
--- a/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/CustomerEmailVerification/MyAccountPromptTest.php
@@ -157,29 +157,17 @@ 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 );
- $email = WC()->mailer()->get_emails()['WC_Email_Customer_Verify_Email'];
- $previous_email_enabled = $email->enabled;
- $email->enabled = 'no';
+ $option_name = 'woocommerce_customer_verify_email_settings';
+ $previous_value = get_option( $option_name, null );
+ $email_settings = is_array( $previous_value ) ? $previous_value : array();
- try {
- $this->assertSame( '', $this->render_prompt(), 'The prompt should not render when its email is disabled.' );
- } finally {
- $email->enabled = $previous_email_enabled;
- }
- }
+ $email_settings['enabled'] = 'no';
+ update_option( $option_name, $email_settings );
- /**
- * @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.' );
+ $this->assertSame( '', $this->render_prompt(), 'The prompt should not render when its email is disabled.' );
} finally {
- remove_filter( 'woocommerce_email_enabled_customer_verify_email', '__return_false' );
+ $this->restore_option( $option_name, $previous_value );
}
}