An inventory level represents the available quantity of an inventory item at a specific location.
Each inventory level belongs to one inventory item and has one location. For every location where an inventory item is available, there's an inventory level that represents the inventory item's quantity at that location:
Inventory levels and fulfillment service locations
A fulfillment service location has a 1:1 relationship with a
third-party fulfillment service. When an app creates a new
fulfillment service on a store, Shopify automatically creates a location that's associated with that
fulfillment service. The FulfillmentService resource has a
location_id property, which identifies the associated location.
An inventory item connected to a fulfillment service location can't be connected to any other locations at the same time:
Connecting an inventory item to a fulfillment service location
When you work with items that have been or will be connected a fulfillment location, you should include
"relocate_if_necessary": true in the body of the request. There are two situations where you might
- connecting an inventory item to a fulfillment service location and disconnecting it from all standard locations
- connecting an inventory item to one or more standard locations and disconnecting it from a fulfillment service location
true, then all
inventory for the item is relocated to the new location and disconnected from any other locations. If a fulfillment service location is involved but
false, then the connection will fail. If no fulfillment service is involved, then the
property is ignored and no inventory is relocated.
Setting the inventory level at a fulfillment service location
When you set inventory for a location, the inventory item is connected to the location if they are not already connected.
If the item has been or will be connected to a fulfillment service location, then you should include
"disconnect_if_necessary": true in the body of the request.
There are two situations where you might do this:
- setting inventory for an inventory item at a fulfillment service location when the item is already connected to one or more standard locations
- setting inventory for an inventory item at a standard location when the item is already connected to a fulfillment service location
The inventory at the new location is set to the value of the
available property. The inventory for
other locations is set to 0 and the locations are disconnected from the inventory item.
disconnect_if_necessary is set to
false when you set inventory at a location and a fulfillment service
location is involved, then the action will fail. If no fulfillment service location is involved, then this property is ignored.
What you can do with InventoryLevel
The Shopify API lets you do the following with the InventoryLevel resource. More detailed versions of these general actions may be available:
- GET /admin/api/2019-10/inventory_levels.json Retrieves a list of inventory levels
- POST /admin/api/2019-10/inventory_levels/adjust.json Adjusts the inventory level of an inventory item at a location
- DELETE /admin/api/2019-10/inventory_levels.json?inventory_item_id=808950810&location_id=905684977 Deletes an inventory level from a location
- POST /admin/api/2019-10/inventory_levels/connect.json Connects an inventory item to a location
- POST /admin/api/2019-10/inventory_levels/set.json Sets the inventory level for an inventory item at a location
The quantity of inventory items available for sale. Returns