Skip to main content

updateCustomer

Update a customer. Only the provided fields change; passing null for a nullable field clears it, so parentId: null removes the customer from its family.

Business Rules​

  • At least one field besides id must be provided.
  • name and customerType cannot be cleared, only replaced.
  • taxExempt and billToSameAsShipTo cannot be set to null.
  • handle, when given, is unique within the company, archived customers included.
  • parentId keeps the single-level family invariant: the parent may not itself have a parent, and a customer that already has children cannot be given one.
  • shippingAccounts replaces the whole set: include the id of a row to keep it, and pass an empty list to remove them all.
  • Default addresses change only when their argument is provided. Pass null to remove that typed address. billingAddress may be provided only when the effective billToSameAsShipTo value is false.
  • Archived customers can still be updated.

Error Scenarios​

  • **BAD_REQUEST**: no updatable field was provided; name is blank or longer than 255 characters; email or website is malformed; customerType or freightPayer is outside the accepted values; taxExempt or billToSameAsShipTo was set to null; a contact preference is too long; a billing address is provided while bill-to mirrors ship-to; a shipping account is missing its carrier or account number, or belongs to another customer; the customer is given itself as parent; or the family would end up more than one level deep.
  • **NOT_FOUND**: the customer, salesChannelId, parentId or defaultTemplateId does not belong to this company.
  • **CONFLICT**: another customer in the company already uses this handle.

Permissions Required​

  • customers:update_customer permission.
updateCustomer(
input: UpdateCustomerInput!
): UpdateCustomerPayload

Arguments​

updateCustomer.input ● UpdateCustomerInput! non-null input common​

Parameters for UpdateCustomer

Type​

UpdateCustomerPayload object common​

Autogenerated return type of UpdateCustomer.