Address Management
The customer’s saved address book is used for delivery, billing, postal marketing, and is referenced by subscriptions and checkout. All address queries and mutations require authentication; availability is gated by ADDRESS_MANAGEMENT, with DEFAULT_ADDRESSES and POSTAL_MARKETING unlocking the default- and postal-marketing-address mutations.
replaceAddress deletes the existing record and inserts a new one — it does not update in place. Any references to the old address id (for example a subscription’s addressId) need to be updated to the returned new id.
Listing addresses
query CustomerAddresses { customer { addresses(offset: 0, limit: 20) { total hasMore addresses { id address { addresseeName companyName addressLine1 addressLine2 addressLine4 addressLine5 state postalCode country phoneNumber clickAndCollect defaultDeliveryAddress defaultBillingAddress postalMarketingAddress } } } }}Filter by id to fetch a single address:
query SingleAddress { customer { addresses(filter: { id: "addr_98765" }, limit: 1) { addresses { id address { addresseeName addressLine1 postalCode country } } } }}Adding an address
Returns the new address id. Pass the defaultDeliveryAddress, defaultBillingAddress and postalMarketingAddress flags here to set the new address as a default at the same time.
mutation AddAddress { addAddress( input: { addresseeName: "Jane Shopper" addressLine1: "10 Downing Street" addressLine4: "London" postalCode: "SW1A 2AA" country: GB phoneNumber: "+447700900123" defaultDeliveryAddress: true } )}Replacing an address
Use this for edits. The old id is removed and a new id is returned. Address fields are not partial — supply the full address as you want it stored.
mutation ReplaceAddress { replaceAddress( input: { id: "addr_98765" addressInput: { addresseeName: "Jane Shopper" addressLine1: "11 Downing Street" addressLine4: "London" postalCode: "SW1A 2AA" country: GB defaultDeliveryAddress: true } } )}Deleting an address
mutation DeleteAddress { deleteAddress(id: "addr_98765")}Setting default delivery and billing addresses
mutation SetDefaultDelivery { setDefaultDeliveryAddress(id: "addr_98765")}mutation SetDefaultBilling { setDefaultBillingAddress(id: "addr_98765")}Clearing default addresses
mutation ClearDefaultDelivery { removeDefaultDeliveryAddress}mutation ClearDefaultBilling { removeDefaultBillingAddress}Setting the postal marketing address
Used by sites with postal marketing — separate from the delivery address so the customer can receive catalogues at one address while shipping orders to another.
mutation SetPostalMarketingAddress { setPostalMarketingAddress(id: "addr_98765")}