---
title: inventory
description: >-
  Reference for the ShopifyQL `inventory` schema. Every metric and dimension,
  paired with worked example queries.
api_version: 2026-07
source_url:
  html: 'https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory'
  md: 'https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory.md'
api_name: shopifyql
---

# inventory

The `inventory` [schema](https://shopify.dev/docs/api/shopifyql/latest/schemas) captures point-in-time snapshots across all your inventory items and products, totaled across locations. Use it for stock, inventory value, sell-through, movement, and availability views when you don't need a per-location breakdown.

### Use cases

* **Unit movement**: Compare [`starting_inventory_units`](#inventorymetric-propertydetail-startinginventoryunits), [`inventory_units_sold`](#inventorymetric-propertydetail-inventoryunitssold), and [`ending_inventory_units`](#inventorymetric-propertydetail-endinginventoryunits) for a snapshot interval to split stock sold from stock remaining.
* **Sell-through**: Group [`sell_through_rate`](#inventorymetric-propertydetail-sellthroughrate) by [`product_id`](#inventorydimension-propertydetail-productid) or [`product_variant_id`](#inventorydimension-propertydetail-productvariantid) to report product-level inventory movement.
* **Cost vs. retail**: Show [`ending_inventory_value`](#inventorymetric-propertydetail-endinginventoryvalue) and [`ending_inventory_retail_value`](#inventorymetric-propertydetail-endinginventoryretailvalue) together to compare stock cost against retail price.
* **Stock duration**: Pair [`days_of_inventory_remaining`](#inventorymetric-propertydetail-daysofinventoryremaining) with [`inventory_units_sold_per_day`](#inventorymetric-propertydetail-inventoryunitssoldperday).

Examples

### Examples

* ####

  ##### Description

  Compare monthly \`sell\_through\_rate\` this quarter against the previous quarter. This example uses \[\`WITH PERCENT\_CHANGE\`]\(/docs/api/shopifyql/latest/syntax/with#percent-change-columns) to add a period-over-period column beside the stock levels.

  ##### ShopifyQL

  ```shopifyql
  FROM inventory
    SHOW ending_inventory_value, ending_inventory_units, inventory_units_sold,
      sell_through_rate, days_out_of_stock
    TIMESERIES month WITH PERCENT_CHANGE, TOTALS
    DURING this_quarter
    COMPARE TO previous_period
    ORDER BY month ASC
  VISUALIZE sell_through_rate TYPE stacked_area
  ```

* ####

  ##### Description

  Rank the top 100 tracked variants by \`ending\_inventory\_value\` last month. This example uses a \[\`WHERE\`]\(/docs/api/shopifyql/latest/syntax/where) clause to keep only variants with recorded cost data.

  ##### ShopifyQL

  ```shopifyql
  FROM inventory
    SHOW ending_inventory_units, ending_inventory_value
    WHERE inventory_cost_is_recorded = true
      AND inventory_is_tracked = true
    GROUP BY product_title, product_variant_title, product_variant_sku,
      inventory_item_cost WITH TOTALS
    DURING last_month
    ORDER BY ending_inventory_value DESC
    LIMIT 100
  VISUALIZE ending_inventory_value TYPE table
  ```

* ####

  ##### Description

  Track weekly retail value on hand, days of stock remaining, and units sold per day for tracked inventory across last quarter. This example uses \[\`WHERE\`]\(/docs/api/shopifyql/latest/syntax/where) \`inventory\_is\_tracked = true\` to keep only variants with inventory tracking turned on.

  ##### ShopifyQL

  ```shopifyql
  FROM inventory
    SHOW days_of_inventory_remaining, inventory_units_sold_per_day,
      ending_inventory_retail_value
    WHERE inventory_is_tracked = true
    TIMESERIES week WITH TOTALS
    DURING last_quarter
    ORDER BY week ASC
  VISUALIZE ending_inventory_retail_value TYPE line
  ```

* ####

  ##### Description

  Track weekly \`ending\_inventory\_units\` by \`product\_id\` across last quarter. This example uses \[\`GROUP\_TOTALS\`]\(/docs/api/shopifyql/latest/syntax/with#group-total-columns) to add a per-week total across products beside the per-product bands, with \`LIMIT 20\` capping the returned rows.

  ##### ShopifyQL

  ```shopifyql
  FROM inventory
    SHOW ending_inventory_units
    GROUP BY product_id WITH TOTALS, GROUP_TOTALS
    TIMESERIES week
    DURING last_quarter
    ORDER BY week ASC
    LIMIT 20
  VISUALIZE ending_inventory_units TYPE stacked_bar
  ```

***

## Metrics

Counts and calculations that let you track key business indicators. Metrics show up as the columns when queried.

Metrics you can use when querying `FROM inventory`.

* **days\_​in\_​inventory**

  **DAY\_DURATION**

  The number of days from the item's first inventory snapshot in your selected period through its last.

* **days\_​in\_​stock**

  **DAY\_DURATION**

  The number of days in your selected period when ending stock was above zero.

* **days\_​of\_​inventory\_​remaining**

  **DAY\_DURATION**

  A forecast of how many days your ending stock could last at the current sales pace. If no units sold in the selected period, then no forecast is returned.

  `Days of inventory remaining = ending inventory units / inventory units sold per day`

* **days\_​out\_​of\_​stock**

  **DAY\_DURATION**

  The number of days in your selected period when ending stock was zero or below.

* **ending\_​inventory\_​retail\_​value**

  **MONEY**

  The retail value of stock on hand at the end of your selected period, in your store's currency. It uses each variant's price and the ending unit count. Untracked items, items without a price, and items with zero or negative ending stock contribute 0.

  `Ending inventory retail value = ending inventory units * product variant price`

* **ending\_​inventory\_​units**

  **INTEGER**

  Inventory units at the end of the given period

* **ending\_​inventory\_​value**

  **MONEY**

  The cost value of stock on hand at the end of your selected period, in your store's currency. It uses the item's recorded cost and ending unit count. Untracked items, items without a recorded cost, and items with zero or negative ending stock contribute 0.

  `Ending inventory value = ending inventory units * inventory item cost`

* **first\_​day\_​in\_​inventory**

  **DAY\_TIMESTAMP**

  The first day in your selected period when the item appears in inventory snapshots.

* **inventory\_​units\_​sold**

  **INTEGER**

  Quantity of inventory units sold in a given period

* **inventory\_​units\_​sold\_​per\_​day**

  **FLOAT**

  Inventory units sold per day in the given period with a record of the inventory item

  `Inventory units sold per day = inventory units sold / days in inventory`

* **last\_​day\_​in\_​inventory**

  **DAY\_TIMESTAMP**

  The last day in your selected period when the item appears in inventory snapshots.

* **percent\_​of\_​inventory\_​sold**

  **PERCENT**

  The share of starting stock sold during your selected period, shown as a percentage. If starting stock is zero or below, then no percentage is returned.

  `Percent of inventory sold = inventory units sold / starting inventory units`

* **sell\_​through\_​rate**

  **PERCENT**

  The share of available units that sold during your selected period, shown as a percentage.

  `Sell-through rate = inventory units sold / (inventory units sold + ending inventory units)`

* **starting\_​inventory\_​units**

  **INTEGER**

  Inventory units at the start of the given period

### DAY\_DURATION

A duration measured in days.

```ts
```

### MONEY

A monetary amount representing currency values such as prices, revenue, costs, and discounts.

```ts
```

### INTEGER

A whole number without decimal places, used for counts, quantities, and other discrete numeric values.

```ts
```

### DAY\_TIMESTAMP

A date value truncated to day precision.

```ts
```

### FLOAT

A floating-point number used for measurements, rates, and other continuous numeric values.

```ts
```

### PERCENT

A percentage value represented as a decimal, where 0.25 represents 25%.

```ts
```

***

## Dimensions

Attributes of your data that let you look more granularly at aspects of the data. Group and filter by dimensions to shape the rows your query returns.

Dimensions you can use when querying `FROM inventory`.

* **day**

  **DAY\_TIMESTAMP**

  The day an inventory snapshot applies to.

* **inventory\_​item\_​id**

  **IDENTITY**

  The unique Shopify identifier for the inventory item. Use [`inventory_item_id`](#inventorydimension-propertydetail-inventoryitemid) with [`product_title`](#inventorydimension-propertydetail-producttitle) or [`product_variant_sku`](#inventorydimension-propertydetail-productvariantsku) to show readable labels.

* **month**

  **MONTH\_TIMESTAMP**

  The month an inventory snapshot applies to.

* **product\_​id**

  **IDENTITY**

  The unique Shopify identifier for the product, which might have multiple variants. Use [`product_id`](#inventorydimension-propertydetail-productid) with [`product_title`](#inventorydimension-propertydetail-producttitle) to show readable labels.

* **product\_​variant\_​id**

  **IDENTITY**

  The unique Shopify identifier for the product variant. Use [`product_variant_id`](#inventorydimension-propertydetail-productvariantid) with [`product_variant_title`](#inventorydimension-propertydetail-productvarianttitle) or [`product_variant_sku`](#inventorydimension-propertydetail-productvariantsku) to show readable labels.

* **quarter**

  **QUARTER\_TIMESTAMP**

  The quarter an inventory snapshot applies to.

* **shop\_​id**

  **IDENTITY**

  The unique Shopify identifier for your store. Use [`shop_id`](#inventorydimension-propertydetail-shopid) with [`shop_name`](#inventorydimension-propertydetail-shopname) to show readable store labels.

* **week**

  **WEEK\_TIMESTAMP**

  The week an inventory snapshot applies to.

* **year**

  **YEAR\_TIMESTAMP**

  The year an inventory snapshot applies to.

* **inventory\_​cost\_​is\_​recorded**

  **BOOLEAN**

  Whether the inventory item has a cost saved in Shopify, with values `true` and `false`.

* **inventory\_​is\_​tracked**

  **BOOLEAN**

  Whether Shopify tracks inventory adjustments for the inventory item, with values `true` and `false`.

* **inventory\_​item\_​cost**

  **MONEY**

  The cost recorded for one unit of the inventory item, in your store's currency.

* **shop\_​name**

  **STRING**

  Name of your store

* **product\_​status**

  **STRING**

  The product's current publishing state, with values Active, Archived, Draft, Suspended, and Unlisted.

* **product\_​title**

  **STRING**

  Display name of the product that your customers see

* **product\_​type**

  **STRING**

  Type (category) that you've assigned to the product

* **product\_​vendor**

  **STRING**

  Vendor of the product

* **product\_​collection**

  **STRING**

  Collection associated with the product

* **product\_​collections**

  **ARRAY\<STRING>**

  Set of collections associated with the product

* **app\_​product\_​creation**

  **STRING**

  The app that created the product, shown as an app name.

* **product\_​tag**

  **STRING**

  Tag associated with the product

* **product\_​tags**

  **ARRAY\<STRING>**

  Set of tags associated with the product

* **product\_​variant\_​abc\_​grade**

  **STRING**

  The ABC grade assigned to the product variant based on its share of revenue. A-grade variants account for about 80% of revenue, B-grade for 15%, and C-grade for 5%.

* **product\_​variant\_​sku**

  **STRING**

  SKU of the product variant

* **product\_​variant\_​title**

  **STRING**

  Display name of the product variant

### IDENTITY

A unique identifier for a Shopify resource such as a customer, product, or order.

```ts
```

### MONTH\_TIMESTAMP

A date value representing the start of a month.

```ts
```

### QUARTER\_TIMESTAMP

A date value representing the start of a fiscal quarter.

```ts
```

### WEEK\_TIMESTAMP

A date value representing the start of a week.

```ts
```

### YEAR\_TIMESTAMP

A date value representing the start of a year.

```ts
```

### BOOLEAN

A true or false value representing binary states.

```ts
```

### STRING

A sequence of characters representing text data.

```ts
```

### ARRAY

A list of values. The element type appears inside angle brackets, such as ARRAY\<STRING>.

```ts
```

***

## Related schemas

* [`inventory_by_location`](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_by_location): Same data broken down by location for stockout and stale-stock analysis.
* [`inventory_adjustment_history`](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_adjustment_history): Manual and automated stock adjustments that explain inventory changes.
* [`inventory_shipments`](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_shipments): Incoming shipment data for what's replenishing stock.
* [`inventory_transfers`](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_transfers): Stock moves between locations that affect on-hand totals.

***
