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 ECE error for virtual products and when no shipping zones are set up #3595

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

annemirasol
Copy link
Contributor

@annemirasol annemirasol commented Nov 8, 2024

Changes proposed in this Pull Request:

In #3560, we fixed a scenario that causes ECE to crash on block checkout and block cart whenever the customer's ECE card address is not part of the shipping zones defined by the store. This however introduced a bug that causes a "Developer error" when there are no shipping methods set up, or when using ECE for virtual orders.

This PR fixes that behavior, such that:

  • Virtual products should be unaffected by shipping zone setup.
  • When there are no shipping zones set up, customers can still use ECE to place orders, similar to how we already let them use CC and other payment methods.
    • This is true for both shippable and virtual orders.
  • When there are shipping zones set up, but the customer's ECE card address is not part of any shipping zones defined, or has no shipping methods for it, we give the user a chance to change their address in the ECE modal. This is what Fix ECE crash when address has no defined shipping rates #3560 fixed -- we are not undoing this.

Testing instructions

When there are no shipping methods defined, I can still use ECE to purchase shippable orders.

  1. Go to WooCommerce > Shipping and delete all shipping zones.
  2. As a shopper, verify that you can purchase using ECE in block cart and block checkout.
  3. Verify that this ECE behavior is consistent with non-ECE, e.g. credit card.

When there are shipping methods defined, but my ECE card address is not covered under shipping, I am asked in the modal to change my address for shippable orders.

  1. Go to WooCommerce > Shipping, add a shipping method for Japan, and delete all other shipping zones.
  2. Add your Google Pay account to the test group, to easily gain access to multiple addresses: https://groups.google.com/g/googlepay-test-mode-stub-data
  3. As a shopper, verify that you are only allowed to push through with a shippable order when you select the Japan address.
  4. Verify that this ECE behavior is consistent with non-ECE, e.g. credit card.

My ability to purchase virtual orders via ECE should not be affected

  1. As a shopper, verify that you can purchase virtual products via ECE regardless of how shipping zones are set up.

Post merge

@annemirasol annemirasol changed the title Fix ECE bug when there are no shipping zones Fix ECE bug when there are no shipping methods Nov 8, 2024
@annemirasol annemirasol changed the title Fix ECE bug when there are no shipping methods Fix ECE bug when there are no shipping zones Nov 8, 2024
@annemirasol annemirasol self-assigned this Nov 8, 2024
@annemirasol annemirasol marked this pull request as ready for review November 11, 2024 15:51
@annemirasol annemirasol changed the title Fix ECE bug when there are no shipping zones Fix ECE error for virtual products and when no shipping zones are set up Nov 11, 2024
@annemirasol annemirasol requested review from a team and Mayisha and removed request for a team November 11, 2024 16:59
Copy link
Contributor

@Mayisha Mayisha left a comment

Choose a reason for hiding this comment

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

This is working as described 🎉

✅ I can purchase virtual products regardless of the shipping zone setup.
✅ I can use ECE to purchase products when there is no shipping zone set, same behavior as card payment.
✅ When the selected shopping address on GPay modal does not match any of the shipping zones, I can see the Invalid shipping address message and the modal allows me to choose a different address.

@annemirasol annemirasol merged commit 0470ff0 into develop Nov 12, 2024
34 of 35 checks passed
@annemirasol annemirasol deleted the fix/ece-handle-no-shipping-zones branch November 12, 2024 19:25
diegocurbelo pushed a commit that referenced this pull request Nov 14, 2024
… up (#3595)

* Fix ECE bug when there are no shipping zones

* Add unit tests

* Only set shippingRates if cart is shippable
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