Issue Updating Delivery Address in Checkout

Hi everyone,

I’m working on updating the customer’s shipping address, and while the update is successfully saved, the delivery address in checkout does not reflect the changes made by the user. When a new address is created for the first time, it is saved correctly, but when updated, the checkout address remains unchanged.

I believe I need to update the checkout address in addition to the customer’s shipping address. I’m using the cartDeliveryAddressesUpdate mutation for this, adding the required fields, but I’m running into an issue with the id field.

According to the documentation, it should be “The id of the selectable address”, but I’m unsure which ID this refers to. Currently, I’m using the ID of the updated address, but it doesn’t seem to work.

I’m attaching a screenshot for reference. Any guidance would be greatly appreciated!

Thanks in advance.

Hi Matias,

From digging into this it looks like the “The id of the selectable address” is not the same as the customer address ID but is instead specific to the cart or checkout context.

To retrieve the selectable address ID for updating the delivery address in a cart or checkout, you need to query the cart object to fetch its delivery addresses, so it should be something like this:

query GetCartDeliveryAddresses {
  cart(id: "gid://shopify/Cart/123456789") {
    deliveryAddresses {
      id
      address {
        address1
        city
        province
        country
        zip
      }
    }
  }
}