The Customer module synchronizes customer records between Shopify and NetSuite in both directions. The template uses the Shopify GraphQL API for both directions, retrieving richer customer data (including up to 5 addresses and metafields) in a single query.
How the flow works
-
Get customers from Shopify (Export): Uses the GraphQL customers(first, query, after) query (delta-based), including addressesV2(first: 5), email, phone, tags, and metafields for each customer.
-
Create or update customer in NetSuite (Import): Creates a new NetSuite customer or updates an existing one identified by email. The customer record includes: first name, last name, email, phone, shipping and billing addresses (up to 5), subsidiary, currency, and any configured custom fields.
-
Create customer ID map in NetSuite (Import): Writes the Shopify Customer ID back to the NetSuite customer record in the eTail Customer ID field. This cross-reference is used by the order flow to identify customers during order import.
This flow exports customers from NetSuite and creates or updates them in Shopify. The flow looks up whether the customer already exists in Shopify by email before deciding to create or update.
How the flow works
-
Get customers from NetSuite (Export): Uses saved search customsearch_celigo_shopify_ctmr_crtn_pd (delta) to retrieve customers from NetSuite that have been created or updated since the last flow run.
-
Find customer in Shopify (Lookup): Uses the GraphQL customers(first: 1, query: "email:{{record.Email}}") query to check whether a Shopify customer with this email already exists.
-
Create or Update (Router): Customer Router - first matching branch
-
Create: No matching Shopify customer found by email - creates a new Shopify customer
-
Update: Matching Shopify customer found by email - updates the existing Shopify customer
-
-
Post customer address to Shopify (Import): The pre-save script merges address data from multiple NetSuite rows into a single customer object. Tags are converted from a comma-separated NetSuite string to a Shopify array. Metafields are extracted from fields prefixed with meta- and written to the Shopify customer's metafields.
-
Post customer metafields to Shopify (Import): After the customer is created or updated, syncs metafield definitions and values using the metafieldDefinitions(ownerType: CUSTOMER, query: "key:{{record.key}}") GraphQL query to validate the namespace and key before writing.
Note
If you want customer records in NetSuite to include all Shopify metafields, schedule the Shopify-to-NetSuite customer flow before the order flow. If the order flow runs first, customers are created with a minimum of fields only (name, email, address, subsidiary, currency).