updateCustomer mutation
We recommend using the updateCustomerV2 mutation to update a customer.
The updateCustomer
mutation updates the customer's personal information.
To return or modify information about a customer, we recommend you use customer tokens in the header of your GraphQL calls. However, you also can use session authentication.
Syntax
mutation: {updateCustomer(input: CustomerInput!) {CustomerOutput}}
Reference
The updateCustomer
reference provides detailed information about the types and fields defined in this mutation.
Example usage
The following call updates the first name and email address for a specific customer.
Request:
Copied to your clipboardmutation {updateCustomer(input: {firstname: "Rob"email: "robloblaw@example.com"}) {customer {firstname}}}
Response:
Copied to your clipboard{"data": {"updateCustomer": {"customer": {"firstname": "Rob","email": "robloblaw@example.com"}}}}
Errors
Error | Description |
---|---|
"input" value should be specified | The input argument is empty. |
"Email" is not a valid email address. | The value provided in the input .email argument has an invalid format. |
Provide the current "password" to change "email". | To change an email address, specify the correct customer password in the password argument. |
A customer with the same email address already exists in an associated website. | You cannot apply a new email address to a current customer because another user has the same email address. |
Invalid login or password. | The value specified in the password argument is incorrect. |
The current customer isn't authorized. | The current customer is not currently logged in, or the customer's token does not exist in the oauth_token table. |
Related topics
- customer query
- createCustomer mutation
- createCustomerAddress mutation
- updateCustomerAddress mutation
- deleteCustomerAddress mutation