Skip to content

Inventory

Inventory Variants

Query Operators

$populateStocks

Convenience operator to return the all/some stocks of a variant. All stocks of a variant will be returned in its $stocks field w/c would contain an array of stocks

Schema

The operator can have a value of either true or a query object that can be used to further filter the returned stocks

Examples
sh
# query all stocks of all returned variants
GET /inventory-variants?$populateStocks=true
[{
  sku: 'somevariant.sku',
  # ...other fields for inventory-variant
  $stocks: [{
    id: 'stock.id',
    variant: 'somevariant.sku',
    # ...other fields for inventory-stock
  }],
}]

# query stocks in a particular stockroom of all returned variants
GET /inventory-variants?$populateStocks[stockroom]=stockRoom1
# query all stocks of all returned variants
GET /inventory-variants?$populateStocks=true
[{
  sku: 'somevariant.sku',
  # ...other fields for inventory-variant
  $stocks: [{
    id: 'stock.id',
    variant: 'somevariant.sku',
    # ...other fields for inventory-stock
  }],
}]

# query stocks in a particular stockroom of all returned variants
GET /inventory-variants?$populateStocks[stockroom]=stockRoom1

Released under the MIT License.