customerSet
Requires access scope.
Creates or updates a customer in a single mutation.
Use this mutation when syncing information from an external data source into Shopify.
This mutation can be used to create a new customer, update an existing customer by id, or upsert a customer by a unique key (email or phone).
To create a new customer omit the identifier
argument.
To update an existing customer, include the identifier
with the id of the customer to update.
To perform an 'upsert' by unique key (email or phone)
use the identifier
argument to upsert a customer by a unique key (email or phone). If a customer
with the specified unique key exists, it will be updated. If not, a new customer will be created with
that unique key.
As of API version 2022-10, apps using protected customer data must meet the protected customer data requirements
Any list field (e.g. addresses, will be updated so that all included entries are either created or updated, and all existing entries not included will be deleted.
All other fields will be updated to the value passed. Omitted fields will not be updated.
Arguments
- Anchor to identifieridentifier•
Specifies the identifier that will be used to lookup the resource.
- Anchor to inputinput•Customer
Set requiredInput! The properties of the customer.
Anchor to CustomerSetPayload returnsCustomerSetPayload returns
- Anchor to customercustomer•
The created or updated customer.
- Anchor to userErrorsuser•
Errors [CustomerSet non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Mutation Reference
Input
{
"identifier": {
"customId": {
"key": "<your-key>",
"namespace": "<your-namespace>",
"value": "<your-value>"
},
"email": "<your-email>",
"id": "gid://shopify/<objectName>/10079785100",
"phone": "<your-phone>"
},
"input": {
"addresses": [
{
"address1": "<your-address1>",
"address2": "<your-address2>",
"city": "<your-city>",
"company": "<your-company>",
"country": "<your-country>",
"countryCode": "",
"firstName": "<your-firstName>",
"id": "gid://shopify/<objectName>/10079785100",
"lastName": "<your-lastName>",
"phone": "<your-phone>",
"province": "<your-province>",
"provinceCode": "<your-provinceCode>",
"zip": "<your-zip>"
}
],
"email": "<your-email>",
"firstName": "<your-firstName>",
"lastName": "<your-lastName>",
"locale": "<your-locale>",
"note": "<your-note>",
"phone": "<your-phone>",
"tags": [
"<your-tags>"
],
"taxExempt": true,
"taxExemptions": [
""
]
}
}
input CustomerSetIdentifiers {
customId: UniqueMetafieldValueInput
email: String
id: ID
phone: String
}
input UniqueMetafieldValueInput {
key: String!
namespace: String
value: String!
}
input CustomerSetInput {
addresses: [MailingAddressInput!]
email: String
firstName: String
id: ID
lastName: String
locale: String
note: String
phone: String
tags: [String!]
taxExempt: Boolean
taxExemptions: [TaxExemption!]
}
input MailingAddressInput {
address1: String
address2: String
city: String
company: String
country: String
countryCode: CountryCode
firstName: String
id: ID
lastName: String
phone: String
province: String
provinceCode: String
zip: String
}