Skip to main content
mutation

Requires write_customer_merge access scope.

Merges two customers.

The customerOneId and customerTwoId arguments don't guarantee which customer is kept. Shopify selects the resulting customer in this order:

  1. If overrideFields.customerIdOfEmailToKeep is provided and valid, then the selected customer is kept.
  2. If exactly one customer has an email address, then that customer is kept.
  3. If both customers have email addresses, then account state and email marketing consent determine the customer that's kept: an enabled account wins over other account states; otherwise, an invited account can win when consent doesn't already prefer subscribed or pending; otherwise the consent result is used. If those rules don't prefer either customer, then customerTwoId is kept.
  4. If neither customer has an email address, then customerTwoId is kept.

Use customerMergePreview and resultingCustomerId to check which customer will be kept before merging.

•ID!
required

The ID of one customer to merge. This customer isn't guaranteed to be kept.

•ID!
required

The ID of another customer to merge. This customer is kept when neither customer has an email address.

•CustomerMergeOverrideFields

The field-specific overrides for default customer merge rules.


Was this section helpful?

Anchor to CustomerMergePayload returnsCustomerMergePayload returns

•Job

The asynchronous job for merging the customers.

•ID

The ID of the customer that's kept after the merge. Treat this ID as authoritative.

•[CustomerMergeUserError!]!
non-null

The list of errors that occurred from executing the mutation.


Was this section helpful?