younifyd
Menu

customerMergePreview

Returns a preview of a customer merge request. The customerOneId and customerTwoId arguments don't guarantee which customer is kept.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the customerMergePreview action (under Customer).
  3. Fill in the fields below, then reference the result from later steps as {{customermergepreview.response.data}}.

Query

This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
query CustomerMergePreview($customerOneId: ID!, $customerTwoId: ID!, $overrideFields: CustomerMergeOverrideFields) {
  customerMergePreview(
    customerOneId: $customerOneId
    customerTwoId: $customerTwoId
    overrideFields: $overrideFields
  ) {
    alternateFields {
      defaultAddress {
        address1
        address2
        city
        company
        coordinatesValidated
        country
        countryCode
        countryCodeV2
        firstName
        formattedArea
        id
        lastName
        latitude
        longitude
        name
        phone
        province
        provinceCode
        timeZone
        validationResultSummary
        zip
      }
      email {
        emailAddress
        marketingOptInLevel
        marketingState
        marketingUnsubscribeUrl
        marketingUpdatedAt
        openTrackingLevel
        openTrackingUrl
        sourceLocation
        validFormat
      }
      firstName
      lastName
      phoneNumber {
        marketingCollectedFrom
        marketingOptInLevel
        marketingState
        marketingUpdatedAt
        phoneNumber
        sourceLocation
        whatsAppMarketingConsent
      }
    }
    blockingFields {
      note
      tags
    }
    customerMergeErrors {
      errorFields
      message
    }
    defaultFields {
      defaultAddress {
        address1
        address2
        city
        company
        coordinatesValidated
        country
        countryCode
        countryCodeV2
        firstName
        formattedArea
        id
        lastName
        latitude
        longitude
        name
        phone
        province
        provinceCode
        timeZone
        validationResultSummary
        zip
      }
      discountNodeCount
      displayName
      draftOrderCount
      email {
        emailAddress
        marketingOptInLevel
        marketingState
        marketingUnsubscribeUrl
        marketingUpdatedAt
        openTrackingLevel
        openTrackingUrl
        sourceLocation
        validFormat
      }
      firstName
      giftCardCount
      lastName
      metafieldCount
      note
      orderCount
      phoneNumber {
        marketingCollectedFrom
        marketingOptInLevel
        marketingState
        marketingUpdatedAt
        phoneNumber
        sourceLocation
        whatsAppMarketingConsent
      }
      tags
    }
    resultingCustomerId
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

customerOneIdstringrequired

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

customerTwoIdstringrequired

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

overrideFieldsobject

The field-specific overrides for default customer merge rules.

customerIdOfFirstNameToKeepstring
customerIdOfLastNameToKeepstring
customerIdOfEmailToKeepstring
customerIdOfPhoneNumberToKeepstring
customerIdOfDefaultAddressToKeepstring
notestring
tagsarray<string>
json
{
  "customerOneId": "string",
  "customerTwoId": "string",
  "overrideFields": {
    "customerIdOfFirstNameToKeep": "string",
    "customerIdOfLastNameToKeep": "string",
    "customerIdOfEmailToKeep": "string",
    "customerIdOfPhoneNumberToKeep": "string",
    "customerIdOfDefaultAddressToKeep": "string",
    "note": "string",
    "tags": [
      "string"
    ]
  }
}

Response

Read the result with {{customermergepreview.response.data.data.customerMergePreview}}. If the API returns errors, the step fails and they are at {{customermergepreview.response.data.errors}}.

alternateFieldsobject
defaultAddressobject21 fields
emailobject9 fields
firstNamestring
lastNamestring
phoneNumberobject7 fields
blockingFieldsobject
notestring
tagsarray<object>
customerMergeErrorsarray<object>
errorFieldsobject
messageobject
defaultFieldsobject
defaultAddressobject21 fields
discountNodeCountstring
displayNamestring
draftOrderCountstring
emailobject9 fields
firstNamestring
giftCardCountstring
lastNamestring
metafieldCountstring
notestring
orderCountstring
phoneNumberobject7 fields
tagsarray<object>
resultingCustomerIdstring

Need more? See the Shopify guide for connection setup and behaviour shared by every action.