Addresses Mutations

CreateAddress

Create an address

Parameters

input - AddressInput
Data of the address
mutation CreateAddress($input: AddressInput!) {
  CreateAddress(input: $input) {
    id
    label
    country
    address_1
    postal_code
    city
    type
    default
  }
}
{
  "input": {
    "label": "Paris Office",
    "country": "FR",
    "address_1": "10 Rivoli Street",
    "postal_code": "75001",
    "city": "Paris",
    "type": "billing",
    "default": true,
    "addressable_id": 123,
    "addressable_type": "Customer"
  }
}
{
  "data": {
    "CreateAddress": {
      "id": 501,
      "label": "Paris Office",
      "country": "FR",
      "address_1": "10 Rivoli Street",
      "postal_code": "75001",
      "city": "Paris",
      "type": "billing",
      "default": true
    }
  }
}

UpdateAddress

Update an address

Parameters

id - ID
Id of the address
input - AddressInput
Data of the address
mutation UpdateAddress($id: ID!, $input: AddressInput!) {
  UpdateAddress(id: $id, input: $input) {
    id
    label
    country
    address_1
    postal_code
    city
    type
    default
  }
}
{
  "id": 501,
  "input": {
    "label": "Lyon Warehouse",
    "address_1": "25 Foch Avenue",
    "postal_code": "69006",
    "city": "Lyon"
  }
}
{
  "data": {
    "UpdateAddress": {
      "id": 501,
      "label": "Lyon Warehouse",
      "country": "FR",
      "address_1": "25 Avenue Foch",
      "postal_code": "69006",
      "city": "Lyon",
      "type": "billing",
      "default": true
    }
  }
}

DeleteAddress

Delete an address

Parameters

id - ID
Id of the address
mutation DeleteAddress($id: ID!) {
  DeleteAddress(id: $id)
}
{ "id": 501 }
{ "data": { "DeleteAddress": true } }

AddressInput data type (full + extensions)

id - ID
Identifier (optional)
label - String
Label of the address
country - String
Country code (e.g. FR, US)
address_1 - String
Address line 1
address_2 - String
Address line 2
postal_code - String
Postal code
city - String
City
state - String
State / Region
phone - String
Phone
dependent_locality - String
Dependent locality
type - String
Address type (e.g. billing, shipping)
default - Boolean
Whether the address is default
addressable_id - ID
Related entity id
addressable_type - String
Related entity type (e.g. Customer)