Use of customerAddressId and deliveryAddress in buyerIdentity

Use of customerAddressId and deliveryAddress in buyerIdentity

cenisuru
Shopify Partner
12 0 0

Hi,

 

In the Storefront API's, cartCreate and cartBuyerIdentityUpdate mutations, we can pass in a customer's addresses through the buyerIdentity's deliveryAddressPreferences parameter.

 

Each DeliveryAddressInput has 2 arguments - `customerAddressId` and `deliveryAddress`. I'm confused about the use of these 2 parameters.

 

  1. What's the difference between the customer address and delivery address?
  2. What's the point of passing the `customerAddressId` if I'm passing the address values via `deliveryAddress` as well?
  3. Can I pass one or the other?
  4. What exactly is the value I should pass to `customerAddressId`? I tried passing the ID of an address I created for a customer (eg: gid://shopify/MailingAddress/9643858624822?model_name=CustomerAddress&customer_access_token=9YEwTXroKTfXi...) but I was getting the following error.
Variable $input of type CartInput was provided invalid value for buyerIdentity.deliveryAddressPreferences.0.customerAddressId (Field is not defined on DeliveryAddressInput)

 

I'm unable to figure this out. Any guidance is appreciated.

 

Thank you.

Replies 2 (2)

DjangoLodozo
Shopify Partner
2 0 0

Hi, you should not use these two values at the same time. Just choose one.

 

 

cenisuru
Shopify Partner
12 0 0

Oh okay. Thanks for clarifying it. I wish the documentation was more clear on this.