Customers¶
The Customers push creates customers in Shopify and updates them, with their addresses, email marketing consent and metafields. It can also send a customer Shopify's account invite.
On a push connector, select Customers as the Shopify Import Type. The push writes each customer through Shopify's customerSet mutation, then sends its addresses, consent, invite and metafields as follow-up requests.
Records¶
| Record | Under | One for each |
|---|---|---|
| Customer | customer | |
| Addresses | Customer | address besides the default |
| Metafields | Customer | metafield on the customer |
Creating and Updating¶
Customer Id and Email Address decide which customer a record writes to:
| Update Operation | Customer Id set | Customer Id blank, Email Address set | Both blank |
|---|---|---|---|
| Insert/Update | Updates that customer | Updates the customer with that email, or creates one | Creates a customer |
| Insert | Fails | Creates a customer. Shopify refuses an email it already has | Creates a customer |
| Update | Updates that customer | Updates the customer with that email, and fails when none has it | Fails |
IMan writes the customer's numeric id back into Customer Id, as soon as Shopify writes the customer. A record with a Customer Id that maps Email Address changes the customer's email.
The push counts every customer it writes as inserted, an update included.
Customer Fields¶
| Field | Rule |
|---|---|
| Customer Id | The customer to update, as a numeric id or a gid. Written back |
| Email Address | Without a Customer Id, finds the customer to update |
| Phone | In international format, such as +442079460123. Shopify refuses a number it can't recognise |
| Tags | Separated by commas. Replaces the customer's tags |
| Tax Exemptions | Shopify tax exemption values, separated by commas, such as CA_STATUS_CARD_EXEMPTION. Replaces the customer's exemptions |
| Accepts Marketing | True subscribes the email to marketing, at single opt-in. False unsubscribes it. Blank leaves it as it is |
| Send Invite Email | True sends Shopify's account invite to a customer who has no account and hasn't had an invite |
| Use Bulk Operations | True sends the run through bulk operations |
IMan leaves a blank field out of the request, and the customer keeps its value. First Name, Last Name and Note carry the rest of the customer's details.
Addresses¶
The def_ fields on the Customer record hold the default address. Each Addresses record holds another address.
- An address with an Address Id (Def. Address Id for the default) updates that address, and only the fields the record maps.
- IMan matches an address without one against the customer's addresses, ignoring case. When every value the record gives equals an existing address's, IMan uses that address. Otherwise it adds a new one.
- The default address becomes the customer's default unless Def. Address Is Default is
False. An Addresses record becomes the default only when Is Default isTrue. - A country code wins over a country name, and a province code over a province name.
IMan writes the default address's id back into Def. Address Id.
Metafields¶
Metafield 1 to Metafield 10 on the Customer record, and Metafields records under it, set metafields on the customer. They follow the same rules as on the Products push. IMan sends them after the customer, 25 to a request, pooled across customers. A metafield Shopify refuses fails its record with a message that says IMan wrote the customer.
Errors¶
A record that fails a check fails before IMan sends anything:
The record has neither a Customer Id nor an Email Address, and the import's update operation does not allow inserts.
The follow-up requests are not one transaction with the customer. When one fails, the customer and the earlier steps stay written, and the message names the step:
Speed and Bulk Operations¶
The push writes one customer at a time. MaxConcurrentRequests in the connection string speeds up only the metafield requests.
With Use Bulk Operations on, IMan sends the run through Shopify bulk operations:
- In an Update run, IMan first reads every customer's email with one bulk query, to find the customers that records name by email. If that query fails, only those records fail.
- Records that name the same customer go in successive rounds, and the last record wins.
- Each round sends the customers, then their addresses, then consent, then invites, then metafields. A customer whose step failed sends no later step.
Access Scopes¶
The push needs write_customers. See Access Scopes.
Shopify Reference¶
customerSet in Shopify's GraphQL Admin API reference.