in the “ID The ID of the customer to update.”, in what case this can be used ? or is a error in docs?
https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerCreate
in the “ID The ID of the customer to update.”, in what case this can be used ? or is a error in docs?
https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerCreate
Not a docs error, CustomerInput is the same input type shared by customerUpdate, that’s where id applies. On customerCreate it’s a no-op since you’re making a brand new customer and there’s no id yet.
I think you need to use like this.
mutation {
customerSet(
identifier: {
id: “gid://shopify/Customer/123456789”
}
input: {
firstName: “John”
lastName: “Smith”
}
) {
customer {
id
firstName
lastName
}
userErrors {
field
message
}
}
}
If there is no id that means you are trying to create customer.
CustomerInput is shared with customerUpdate, that’s why id shows up in the type even though create ignores it. If you want create-or-update in one call, customerSet is built for that, it takes a separate identifier argument (id/email/phone) plus CustomerSetInput for the fields.