Commit 772ec2bc91f for woocommerce

commit 772ec2bc91f94bcf92d47c69a4d8d690c4604f43
Author: SH Sajal Chowdhury <72102985+shsajalchowdhury@users.noreply.github.com>
Date:   Fri May 1 23:23:32 2026 +0600

    Add after_password_reset action hook to WooCommerce password reset (#64380)

    * Add after_password_reset action hook to WC password reset

    Fires the after_password_reset action after WooCommerce resets a user's
    password, providing parity with WordPress core's reset_password() function.
    This allows plugins to properly hook into WooCommerce password resets.

    Fixes #27795

    * Fix after_password_reset: add $new_pass param and match core execution order

    CodeRabbit suggestions:
    - Pass $new_pass as second parameter to match WordPress core signature
    - Move hook after update_user_meta for default_password_nag to match
      core's execution order exactly

    * Add changelog entry

    * docs: bump since annotation to 10.9.0 to match current dev version

    * fix: tighten reset_password param type to WP_User in docblock

    * chore: refresh PHPStan baseline after trunk merge and WP_User fix

    * style: align param column after WP_User type widening

    ---------

    Co-authored-by: Brandon Kraft <public@brandonkraft.com>

diff --git a/plugins/woocommerce/changelog/pr-64380 b/plugins/woocommerce/changelog/pr-64380
new file mode 100644
index 00000000000..cde2b44e4d0
--- /dev/null
+++ b/plugins/woocommerce/changelog/pr-64380
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Add after_password_reset action hook for parity with WordPress core.
diff --git a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
index caff53be5ab..cc081a9d3c8 100644
--- a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
+++ b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
@@ -369,8 +369,8 @@ class WC_Shortcode_My_Account {
 	 *
 	 * @since 9.4.0 This will log the user in after resetting the password/session.
 	 *
-	 * @param object $user     The user.
-	 * @param string $new_pass New password for the user in plaintext.
+	 * @param WP_User $user     The user.
+	 * @param string  $new_pass New password for the user in plaintext.
 	 */
 	public static function reset_password( $user, $new_pass ) {
 		// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
@@ -378,6 +378,17 @@ class WC_Shortcode_My_Account {

 		wp_set_password( $new_pass, $user->ID );
 		update_user_meta( $user->ID, 'default_password_nag', false );
+
+		/**
+		 * Fires after the user's password has been reset via WooCommerce.
+		 *
+		 * This provides parity with WordPress core's reset_password() function.
+		 *
+		 * @since 10.9.0
+		 * @param WP_User $user     The user.
+		 * @param string  $new_pass New user password in plaintext.
+		 */
+		do_action( 'after_password_reset', $user, $new_pass );
 		self::set_reset_password_cookie();
 		wc_set_customer_auth_cookie( $user->ID );

diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 30c43546d47..18433e313e0 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -31971,12 +31971,6 @@ parameters:
 			count: 2
 			path: includes/shortcodes/class-wc-shortcode-checkout.php

-		-
-			message: '#^Access to an undefined property object\:\:\$ID\.$#'
-			identifier: property.notFound
-			count: 3
-			path: includes/shortcodes/class-wc-shortcode-my-account.php
-
 		-
 			message: '#^Constant COOKIEHASH not found\.$#'
 			identifier: constant.notFound
@@ -32055,12 +32049,6 @@ parameters:
 			count: 1
 			path: includes/shortcodes/class-wc-shortcode-my-account.php

-		-
-			message: '#^Parameter \#1 \$user of function wp_password_change_notification expects WP_User, object given\.$#'
-			identifier: argument.type
-			count: 1
-			path: includes/shortcodes/class-wc-shortcode-my-account.php
-
 		-
 			message: '#^Method WC_Shortcode_Order_Tracking\:\:output\(\) has no return type specified\.$#'
 			identifier: missingType.return