-
Notifications
You must be signed in to change notification settings - Fork 207
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 ECE crash when address has no defined shipping rates #3560
Conversation
97a15f1
to
2042a8f
Compare
00fcc2a
to
5fade4c
Compare
* | ||
* @param array $data | ||
*/ | ||
public function get_checkout_data() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to have a simple unit test for this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests in c9c7efe, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #3538
Changes proposed in this Pull Request:
For block cart and block checkout, when Apple Pay, Google Pay or Link loads and the default address (first address, or last selected address) is not defined under Shipping, we get an
IntegrationError
and the cart/checkout page gets stuck trying to load the modal.This happens because for block cart and block checkout, we pass a potentially empty
shippingRates
array option to ECE. WhenshippingRates
is empty butshippingAddressRequired
istrue
, the Stripe JS library throws an error and bails (Stripe docs).This issue does not happen inside the Product and shortcode pages because we are always passing a non-empty "pending"
shippingRates
array when ECE loads.To fix the issue, we will do the same for block cart and block checkout: when we do not have shipping rates for the current address, we will pass a "pending" shipping rates array. With this change, ECE will not crash the page, and the user has a chance to change to a valid shipping address, in case of multiple available addresses.
Testing instructions
develop
: Google Pay modal does not launch and the page is stuck loading.Google Pay
Apple Pay
Link
changelog.txt
andreadme.txt
(or does not apply)Post merge