Shopify / ui-extensions

Repo for the public defintion of Shopify's UI extension APIs. Please use the community forum to ask questions or report issues: https://community.shopify.dev/c/extensions/5
MIT License
270 stars 35 forks source link

useApplyShippingAddressChange() to not update billing address #2409

Open patryk-smc opened 1 month ago

patryk-smc commented 1 month ago

Please list the related package(s)

    "@shopify/ui-extensions": "2024.10.0",
    "@shopify/ui-extensions-react": "2024.10.0",

If this related to specific APIs or components, please list them here

useApplyShippingAddressChange()

Is your feature request related to a problem? Please describe.

We need to update shipping address only and have buyer to explicitly enter their billing address, however after updating the shipping address, the "Use shipping address as billing address" option remains checked.

Describe the changes you are looking for

When updating shipping address, we would need an argument that would

At least: Uncheck "Use shipping address as billing address" checkbox

Or event better: Disable "Use shipping address as billing address" - checkbox - this should force buyer to enter their billing address

Describe alternatives you’ve considered

Updating address after order is created, but this is too late. Billing address is wrong in email notifications and order created webhooks.

Additional context

We are public app and this was requested by many merchants

sjanczy2 commented 1 month ago

Hi @patryk-smc , is there a reason that your merchants cannot use the setting highlighted below? Image

I assume that updating the shipping address via extension API does not set the billing address automatically in this case

patryk-smc commented 1 month ago

Hi Steven, thanks for lighting fast reply! We need to perform address update only for 10-35% of the orders so it doesn't make much sense to make experience worse for majority of the users.

sjanczy2 commented 1 month ago

Do you mind clarifying your use case a little bit? I can make some guesses but it would help to have the full picture

patryk-smc commented 1 month ago

At Atlas Pickup Points, we provide pickup point selection during checkout. Some merchants require the shipping address on the order to be set to the pickup point's address for fulfillment purposes, while the billing address must reflect the actual billing address for tax compliance. Currently, we handle this by updating the shipping address after the order is created. However, not all downstream systems can accommodate this approach. Some systems are so basic that they rely solely on the order created webhook (which initially contains the incorrect address) and are unable to detect the update we make after the order is placed. Then you have this issue with order confirmation email showing invalid address, but this can be resolved with small code change - yet it's not ideal.