Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CashApp Pay and Digital Wallet payments on Block Checkout for WooCommerce 9.3 #216

Closed
wants to merge 3 commits into from

Conversation

iamdharmesh
Copy link
Member

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

This PR fixes the CashApp Pay and Digital Wallet payments on Block Checkout for WooCommerce 9.3. The issue was occurring only with WooCommerce 9.3, and I suspect it's due to the React 18 upgrade in WC 9.3. The token updates in the state are not reflected in onPaymentSetup when onSubmit is called.

This PR fixes the issue by replacing onSubmit(); with setTimeout( onSubmit, 0 );, breaking out of the current event loop to ensure state updates in onPaymentSetup. We are having an ongoing discussion with the Woo Team to figure out the proper fix. However, with WC 9.3 releasing tomorrow, proceeding with this fix for now is fine.

Closes #214

Steps to test the changes in this Pull Request:

  1. Upgrade to WooCommerce 9.3(-rc-1)
  2. Try placing an order using CashApp pay from block checkout and verify its works as expected.
  3. Try placing an order using Digital wallets (GooglePay and ApplePay) from block checkout and verify it works as expected.

Changelog entry

Fix - CashApp Pay and Digital Wallet payments on Block Checkout for WooCommerce 9.3

@iamdharmesh iamdharmesh self-assigned this Sep 10, 2024
@iamdharmesh iamdharmesh added this to the 4.8.0 milestone Sep 10, 2024
Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the changes @iamdharmesh

@Sidsector9
Copy link
Member

Related #217

@iamdharmesh
Copy link
Member Author

Note: The failing test (1 test is failing) is already fixed in the PR #204

@qasumitbagthariya
Copy link
Contributor

QA Update ✅


I have verified this PR in the enhancement/341 branch which has been fixed and is functioning as intended.

I tested the following on this branch:

  • Cash app
  • Digital wallet - Google pay
  • Credit card

Testing Environment

  • WordPress: 6.6.2
  • Theme: Twenty Twenty-Four 1.2
  • WooCommerce - 9.3.0-rc.1
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS Ventura 13.3
  • Branch: fix/214
Google.pay.mov
Cash-app.mov

Copy link
Contributor

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. As discussed internally, Woo may be making changes in 9.3 that would remove the need for us to make this change. Going to hold off on moving this forward until we know for sure their decision

@dkotter
Copy link
Contributor

dkotter commented Sep 13, 2024

Going to close this out since the issue was resolved in Woo 9.3 itself and this fix is no longer needed

@dkotter dkotter closed this Sep 13, 2024
@dkotter dkotter removed this from the 4.8.0 milestone Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Payment using CashApp Pay fails in WooCommerce 9.3-RC-1
4 participants