Shopify Update Strategy¶
A push import decides from each record whether to create a record in Shopify or update an existing one. Most imports decide by the record's Shopify id:
- Leave the id blank to create the record. IMan writes the id Shopify assigns back into the record, and later transforms in the integration can use it.
- Map the record's Shopify id to update it. An id that Shopify does not hold fails the record with Shopify's message.
The GraphQL imports take an id in either form: the numeric id, such as 1234567890, or the global id Shopify's GraphQL API uses, such as gid://shopify/Product/1234567890. IMan writes an id back as a number or a global id, depending on the import. Either form works when you send it back.
To link a new record to an existing one, such as a fulfillment to its order, give the existing record's id, and the line ids where the import asks for them.
Imports That Match on Other Keys¶
Some imports find the existing record by something other than its id:
| Import | Finds the existing record by |
|---|---|
| Products | Product Id. Variants by Variant Id, or by their option values when no variant has an id |
| Customers | Customer id, or email address |
| Metafields, Product MetaFields, Customer MetaFields | Owner, namespace and key |
| Inventory Levels v2 | Inventory item and location. Every record sets the quantity |
Each import's page gives its rules.
Keeping the Ids¶
Keep the ids that write-back returns in the source or target system, such as in a custom field or a lookup table. A later run then updates the same Shopify records instead of creating new ones. The Product Variants and Customers pulls read existing ids from Shopify for records created elsewhere.