Inventory Levels v2¶
The Inventory Levels v2 push sets the stock of inventory items at Shopify locations, from a stock figure in the source system. Each record sets one item's quantity at one location.
On a push connector, select Inventory Levels v2 as the Shopify Import Type. The push sends the records 20 to a request through Shopify's inventorySetQuantities mutation. Every record sets a quantity, whatever the Update Operation.
A typical integration reads the variants with the Product Variants pull for their inventory_item_id, looks up each SKU's stock in a Map transform, and pushes the quantities.
Fields¶
| Field | Rule |
|---|---|
| Inventory Item Id | Required. The variant's inventory item, as a numeric id or a gid |
| Location Id | Required. The location, as a numeric id or a gid |
| Qty | Required. The quantity to set |
| Inventory Change Type (available, on_hand) | available or on_hand. The default is available |
| Inventory Change Reason | The reason Shopify records against the change, such as correction, cycle_count_available or received. The default is other |
| Reference Document URI | Optional. A link to the document behind the change. Shopify keeps it in the item's history |
| Ignore Compare Qty | The default True sets the quantity whatever Shopify holds. False sets it only when Shopify still holds Compare Qty |
| Compare Qty | With Ignore Compare Qty False, the quantity the push expects Shopify to hold. Required then |
| Use Bulk Operations | True sends the run through bulk operations |
To find a location's id, open the location in the Shopify admin and read the number at the end of its address, or use a lookup.
Checking the Quantity First¶
With Ignore Compare Qty False, Shopify changes the quantity only if it still holds Compare Qty. When a sale has moved the stock since the source system read it, Shopify refuses the record. Read the quantity again before you retry. A record with Ignore Compare Qty False and no Compare Qty fails before IMan sends it:
Errors¶
Shopify refuses a request's records together when it can't place the error on one of them. Inventory Change Type, Inventory Change Reason and Reference Document URI belong to a whole request in Shopify. IMan sends records that differ in them as separate requests. Each request then succeeds or fails on its own.
Each request carries an idempotency key. If Shopify answers late and IMan resends the request, Shopify applies it once.
Bulk Operations¶
With Use Bulk Operations on, IMan sends the run through Shopify bulk operations, 250 quantities to a line. Shopify sets a line whole or not at all. When it refuses some of a line's rows, those records fail with Shopify's message, and IMan sends the rest of the line again in a follow-up operation. Under Abort, IMan sends nothing more, and the rest are Not sent. When the run sets one item at one location more than once, the last record wins: IMan sends it in a later operation. A record without an item, a location or a quantity fails before IMan sends anything:
Access Scopes¶
The push needs write_inventory. See Access Scopes.
Shopify Reference¶
inventorySetQuantities in Shopify's GraphQL Admin API reference.