Skip to main content

Shipping and Billing

Customer Address Saving Strategies

Address updates allow configuring the address-saving strategy for both shipping and billing addresses. This setting determines whether the shipping or billing address should be saved in the customer's address book. This setting takes effect only when a draft order is completed for an existing user. If no user is assigned, the setting is ignored.

By default, both billing and shipping addresses are not saved in the customer's address book.

Use cases:

  • Draft order management: Allows staff user to explicitly decide whether to save newly entered addresses to the customer account.

Applicable Order Mutations

The default behavior can be adjusted in the following order mutations:

mutation DraftOrderCreate(
$input: DraftOrderCreateInput!
) {
draftOrderCreate(
input: $input
) {
order {
id
}
}
}

example input data:

{
"input": {
"user": "VXNlcjoxNDM2",
"lines": [{ "quantity": 1, "variantId": "UHJvZHVjdFZhcmlhbnQ6Mjk3" }],
"saveBillingAddress": true,
"billingAddress": {
"firstName": "John"
"lastName": "Doe"
"streetAddress1": "1470 Pinewood Avenue"
"city": "Michigan"
"postalCode": "49855"
"country": "US"
"countryArea": "MI"
},
"saveShippingAddress": false,
"shippingAddress": {
"firstName": "John"
"lastName": "Doe"
"streetAddress1": "1470 Pinewood Avenue"
"city": "Michigan"
"postalCode": "49855"
"country": "US"
"countryArea": "MI"
},
"channelId": "Q2hhbm5lbDoyMjQ0",
}
}
Expand ▼
mutation DraftOrderUpdate(
$id: ID!,
$input: DraftOrderInput!,
) {
draftOrderUpdate(
id: $id,
input: $input
) {
order {
userEmail
externalReference
}
}
}

example input data:

{
"id": "T3JkZXI6ZGJlZjkxZmQtMjMxZS00ZGNmLTk5ZGMtNGQxOTBhNDFjYTQ1",
"input": {
"shippingAddress": {
"postalCode": "22-356"
},
"saveShippingAddress": false
}
}

Important Notes

The setting is treated as part of the address and cannot be provided independently in the mutation input. Attempting to set saveShippingAddress or saveBillingAddress without including the corresponding shippingAddress or billingAddress will result in an error.

For example, providing saveShippingAddress in the draftOrderUpdate mutation without including shippingAddress will raise an error:

mutation DraftOrderUpdate(
$id: ID!,
$input: DraftOrderInput!,
) {
draftOrderUpdate(
id: $id,
input: $input
) {
order {
userEmail
externalReference
}
}
}

invalid input data:

{
"id": "T3JkZXI6ZGJlZjkxZmQtMjMxZS00ZGNmLTk5ZGMtNGQxOTBhNDFjYTQ1",
"input": {
"externalReference": "ref-XYZ",
"saveShippingAddress": false
}
}
warning

Each time the shipping address is updated, the saveAddress flag resets to its default value. To ensure the correct setting is applied, you must explicitly provide the saveAddress value in the input.

  1. Setting a shipping address with saveShippingAddress: true.
mutation DraftOrderUpdate(
$id: ID!,
$input: DraftOrderInput!,
) {
draftOrderUpdate(
id: $id,
input: $input
) {
order {
userEmail
externalReference
}
}
}

example input data:

{
"id": "T3JkZXI6ZGJlZjkxZmQtMjMxZS00ZGNmLTk5ZGMtNGQxOTBhNDFjYTQ1",
"input": {
"shippingAddress": {
"firstName": "John"
"lastName": "Doe"
"streetAddress1": "1470 Pinewood Avenue"
"city": "Michigan"
"postalCode": "49855"
"country": "US"
"countryArea": "MI"
},
"saveShippingAddress": true
}
}
  1. Updating the address without specifying saveShippingAddress. If saveShippingAddress is not provided in the request, the updated address will be not saved in the customer’s address book.
mutation DraftOrderUpdate(
$id: ID!,
$input: DraftOrderInput!,
) {
draftOrderUpdate(
id: $id,
input: $input
) {
order {
userEmail
externalReference
}
}
}

Example input data:

{
"id": "T3JkZXI6ZGJlZjkxZmQtMjMxZS00ZGNmLTk5ZGMtNGQxOTBhNDFjYTQ1",
"input": {
"shippingAddress": {
"postalCode": "49666"
}
}
}

If you want to ensure the address is saved, you must explicitly provide saveShippingAddress: true in step 2.