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

Add support for allowedShippingCountries in Express Checkout Element #9104

Closed
bborman22 opened this issue Jul 16, 2024 · 7 comments · Fixed by #9592
Closed

Add support for allowedShippingCountries in Express Checkout Element #9104

bborman22 opened this issue Jul 16, 2024 · 7 comments · Fixed by #9592
Assignees
Labels
focus: checkout payments priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: enhancement The issue is a request for an enhancement.

Comments

@bborman22
Copy link
Contributor

Description

With the Express Checkout Element from Stripe (ECE), there is an option to provide an allowedShippingCountries parameter when clicking the element. We can retrieve a list of available countries from the merchant settings to provide to this parameter. This enhancement would make the experience smoother for the shopper in a case where some countries they may have saved aren't allowed by the merchant.

Acceptance criteria

  • When using the "Shipping location(s)" setting in WooCommerce the list of available countries is provided to the Stripe ECE to limit addresses to just those countries.
  • The limitation works when the setting is set to all, all except some, and set specific.

Designs

Testing instructions

  1. Set the selling locations to all and confirm all shipping addresses are displayed in Google Pay and Apple Pay.
  2. Set the shipping locations to exclude some countries and confirm any addresses from those countries are not displayed in Google Pay and Apple Pay.
  3. Set the shipping locations to specific countries and confirm only addresses from those countries are displayed in Google Pay and Apple Pay.

Dev notes

Additional context

pcJe93-4x9-p2#comment-4622

@bborman22 bborman22 added type: enhancement The issue is a request for an enhancement. focus: checkout payments labels Jul 16, 2024
@pierorocca pierorocca added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Aug 31, 2024
@bborman22
Copy link
Contributor Author

@asumaran asumaran self-assigned this Oct 17, 2024
@asumaran
Copy link
Contributor

@bborman22 I found a bug while working on this. I tried debugging it without getting too much info about it as it originates on the Stripe library.

The issue occurs when a shipping address from a country without shipping options defined is selected.

If the address is selected, the payment sheet is closed, the page is refreshed, and then the Google Pay button is clicked, the error is thrown in the browser console.

v3/?ver=3.0:1 Uncaught (in promise) IntegrationError: When `shippingAddressRequired` is true, you must specify `shippingRates`.
    at H (v3/?ver=3.0:1:40043)
    at v3/?ver=3.0:1:361350
    at v3/?ver=3.0:1:354353

This is an existing bug, so it is unrelated to the allowedShippingCountries param we’re defining in this issue. I think we can go ahead and implement this PR and address the bug in a separate issue. If no issue exists, I will create one for it. Sounds good to you @bborman22?

@asumaran
Copy link
Contributor

asumaran commented Oct 17, 2024

I can confirm the same error happens with Apple Pay.

edit:

If we go to the Checkout page and the addres is changed from the address that has no shipping options to an address that has shipping options defined then Apple Pay/Google Pay works again.

@bborman22
Copy link
Contributor Author

I think we can go ahead and implement this PR and address the bug in a separate issue. If no issue exists, I will create one for it. Sounds good to you

Yep that is perfect, let's get an issue captured for it and we'll pull into our maintenance rotation, thanks!

@asumaran asumaran linked a pull request Oct 18, 2024 that will close this issue
6 tasks
@asumaran
Copy link
Contributor

@bborman22 issue created: #9593

@asumaran
Copy link
Contributor

@bborman22, just to confirm, this should apply to all areas where ECE can be used, correct? That includes the Product Page, Cart Page, Checkout Page, Cart shortcode, Checkout shortcode, and Pay for Order page.

This will require extensive testing, so I’m going to revise my original estimate, as I initially thought it was only needed for the Cart and Checkout pages.

Additionally, I foresee potential issues with the Pay for Order page if we introduce allowedShippingCountries. Since orders can be created manually, restricting countries could cause problems for existing orders. I think we should exclude the Pay for Order page for now and address it in a separate issue as we need to ensure that we’re not breaking the "Pay for Order" functionality with this change.

@asumaran
Copy link
Contributor

@bborman22 I just noticed we don't ask for shipping details on the "Pay for Order" page.

so this issue won’t impact that page. Please disregard my previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: checkout payments priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants