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

Split UPE - Prevent loading JS scripts when all payment methods are disabled #2867

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

james-allan
Copy link
Contributor

Fixes #2865

Changes proposed in this Pull Request:

This PR fixes the following JS error if you disable all payment methods, including cards.

index.js:24 Uncaught TypeError: Cannot convert undefined or null to object
    at entries (<anonymous>)
    at ./client/blocks/upe/index.js (index.js:24:1)
    at __webpack_require__ (upe_blocks.js?ver=b65b5b1030ced18a6fe92b14ac363333:20:30)
    at upe_blocks.js?ver=b65b5b1030ced18a6fe92b14ac363333:84:18
    at upe_blocks.js?ver=b65b5b1030ced18a6fe92b14ac363333:87:10

Testing instructions

  1. Go to WooCommerce → Settings → Payments → Stripe (Settings)
  2. Enable UPE in the advanced section.
  3. Go to the Payment methods tab and disable all payment methods (including cards).

Screenshot 2024-01-29 at 4 25 11 pm

  1. Add a product to the cart and go to the block checkout page and view the browser console.
    • On add/deferred-intent branch you should see the error message above.
    • On this branch no error is observered.
  2. Disable UPE in Stripe advanced settings, make sure that the the block checkout still works with and without Stripe enabled.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@james-allan james-allan requested a review from a team January 29, 2024 06:33
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

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

LGTM!

Before:
Screenshot 2024-01-29 at 10 36 35

After:
Screenshot 2024-01-29 at 10 34 53

@james-allan james-allan merged commit 9315fe8 into add/deferred-intent Jan 31, 2024
32 checks passed
@james-allan james-allan deleted the fix/issue-2865 branch January 31, 2024 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants