diff --git a/changelog.txt b/changelog.txt index 840d9540e05..ada748198a4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** WooPayments Changelog *** += 8.9.2 - 2025-02-21 = +* Fix - Fixed WooPay opt-in race condition + = 8.9.1 - 2025-02-07 = * Fix - Ensures that the tokenised cart for ECE implementation is disabled by default. diff --git a/client/components/woopay/save-user/checkout-page-save-user.js b/client/components/woopay/save-user/checkout-page-save-user.js index 89c753cae7a..85043da5109 100644 --- a/client/components/woopay/save-user/checkout-page-save-user.js +++ b/client/components/woopay/save-user/checkout-page-save-user.js @@ -275,17 +275,34 @@ const CheckoutPageSaveUser = ( { isBlocksCheckout } ) => { isBlocksCheckout, ] ); + useEffect( () => { + if ( + ! getConfig( 'forceNetworkSavedCards' ) || + ! isWCPayWithNewTokenChosen || + isRegisteredUser + ) { + // Clicking the place order button sets the extension data in backend. If user changes the payment method + // due to an error, we need to clear the extension data in backend. + if ( isBlocksCheckout && userDataSent ) { + sendExtensionData( true ); + } + clearValidationError( errorId ); + } + }, [ + clearValidationError, + errorId, + isBlocksCheckout, + isRegisteredUser, + isWCPayWithNewTokenChosen, + sendExtensionData, + userDataSent, + ] ); + if ( ! getConfig( 'forceNetworkSavedCards' ) || ! isWCPayWithNewTokenChosen || isRegisteredUser ) { - // Clicking the place order button sets the extension data in backend. If user changes the payment method - // due to an error, we need to clear the extension data in backend. - if ( isBlocksCheckout && userDataSent ) { - sendExtensionData( true ); - } - clearValidationError( errorId ); return null; } diff --git a/package-lock.json b/package-lock.json index ded73102317..ffe1e41337a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-payments", - "version": "8.9.1", + "version": "8.9.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "woocommerce-payments", - "version": "8.9.1", + "version": "8.9.2", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 6c1e4288aaf..b5efb52feb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-payments", - "version": "8.9.1", + "version": "8.9.2", "main": "webpack.config.js", "author": "Automattic", "license": "GPL-3.0-or-later", diff --git a/readme.txt b/readme.txt index d1b7d9f5d2c..1e087371cdc 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment Requires at least: 6.0 Tested up to: 6.7 Requires PHP: 7.3 -Stable tag: 8.9.1 +Stable tag: 8.9.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -87,6 +87,10 @@ You can read our Terms of Service and other policies [here](https://woocommerce. == Changelog == += 8.9.2 - 2025-02-21 = +* Fix - Fixed WooPay opt-in race condition + + = 8.9.1 - 2025-02-07 = * Fix - Ensures that the tokenised cart for ECE implementation is disabled by default. diff --git a/woocommerce-payments.php b/woocommerce-payments.php index 4aefaee907a..244dfec6232 100644 --- a/woocommerce-payments.php +++ b/woocommerce-payments.php @@ -11,7 +11,7 @@ * WC tested up to: 9.6.0 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 8.9.1 + * Version: 8.9.2 * Requires Plugins: woocommerce * * @package WooCommerce\Payments