Skip to main content

createCustomer

Create a customer: the relationship with a specific buying entity, such as a retailer, a wholesale account or an individual. The name is the identity anchor, the optional handle is the unique key within the company and is useful as an upload upsert key, and the email is plain contact detail.

Business Rules​

  • handle, when given, is unique within the company, archived customers included.
  • email is contact detail only; several customers may share one.
  • parentId links the customer into a single-level family for reporting rollup: the parent may not itself have a parent.
  • salesChannelId sets the customer's home sales channel, used for grouping and as the default channel on manual orders.
  • Every shipping account needs a carrier and an account number.
  • billingAddress may be provided only when billToSameAsShipTo is false.
  • Contact preference text is trimmed and limited to 100 characters.

Error Scenarios​

  • **BAD_REQUEST**: name is blank or longer than 255 characters; email or website is malformed; customerType or freightPayer is outside the accepted values; 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; the customer is given itself as parent; or the family would end up more than one level deep.
  • **NOT_FOUND**: salesChannelId, parentId or defaultTemplateId does not belong to this company.
  • **CONFLICT**: another customer in the company already uses this handle.

Permissions Required​

  • customers:create_customer permission.
createCustomer(
input: CreateCustomerInput!
): CreateCustomerPayload

Arguments​

createCustomer.input ● CreateCustomerInput! non-null input common​

Parameters for CreateCustomer

Type​

CreateCustomerPayload object common​

Autogenerated return type of CreateCustomer.