Shopify / ui-extensions

MIT License
266 stars 36 forks source link

useApplyShippingAddressChange hook on one-page checkout changes back to the first saved address #1915

Closed TheSecurityDev closed 2 months ago

TheSecurityDev commented 5 months ago

Please list the package(s) involved in the issue, and include the version you are using

@shopify/ui-extensions-react v2024.1.1

Describe the bug

When a customer is logged in and has saved addresses in their account, they are able to select which address to use on the one-page checkout.

However, when updating the address from an extension with the useApplyShippingAddressChange hook, if the new address doesn't match any of the addresses in the customer's account, it changes back to the first address in the list.

This causes an issue for address validation apps where when you show a suggested address change, trying to switch to that address doesn't work because it will reselect the top address in the list.

Also, this causes a critical infinite-loop issue if the app auto-updates part of the address, such as adding the full +4 zip code or something automatically. The app changes to the first address, but then autofills the address, which then causes it to select the first address again.

This issue doesn't happen on the 3-page checkout, because if the address entered is not the same as one of the saved ones, it changes it to a custom address and still allows entering.

Steps to reproduce the behavior:

  1. Use a one-page checkout.
  2. Log in to a customer account that has saved addresses.
  3. Create a checkout extension that uses the useApplyShippingAddressChange hook to update the address.
  4. Observe that when the address is updated, it switches back to the first address automatically, which overwrites the update.

Expected behavior

When updating the address with the useApplyShippingAddressChange hook on the one-page checkout, it should allow entering a custom address instead of trying to auto-select one of the saved ones.

Screenshots

image image

Additional context

This issue was reported to us by a user of our app, who was getting reports from their customers about this issue. It's causing an infinite loop and preventing them from checking out. We also believe this is the reason we received a 1-star review (first review) on the app recently.

jamesvidler commented 5 months ago

Thank you for reporting this issue. We have reproduced the issue when the vaulted section for "Ship to" is expanded on 1 page checkout. The team will look to implement a fix for this.

TheSecurityDev commented 4 months ago

Hey, just wondering if there's any updates on this? The merchant has been waiting for a fix for about 2 weeks now.

oshima0226 commented 4 months ago

@jamesvidler Hi, I think this is a critical issue for both the app and merchants using useApplyShippingAddressChange. Could you please provide an update on the status of this issue?

TheSecurityDev commented 3 months ago

Any updates? It's kind of sad when bugs like this take months to resolve. 😕

PrakharJain-Globant commented 3 months ago

@jamesvidler I am facing the similar issue. Any update on the fix?

robinhosanee commented 3 months ago

This is absolutely a critical issue and with the enforced checkout extensibility upgrade around the corner it would be vital to get a fix or at least an update.

abrahambeshara commented 2 months ago

Is there an update on this? It seems to have been open for a while and causing many of us issues with our extensions. Can we please get an update on an ETA release to let our customers know

jamesvidler commented 2 months ago

Thank you for your patience everyone. This issue should now be resolved for one page checkouts with customer accounts. If you encounter any further issues, please let us know.