Unlock Sales Velocity: Getting Historical Inventory Data from Shopify's API

The Quest for Accurate Sales Velocity: Why Historical Inventory Matters

Hey everyone, it's [Your Name], chiming in on a topic that I know a lot of you Shopify store owners are grappling with: getting a *true* handle on your sales velocity. It's not just about how many days a product has been listed, but how many days it was actually *available* to buy, right?

I recently saw a great thread in the Shopify Community started by Oliver (oly5069) about this very issue. He was trying to build custom analytics apps and ran into a brick wall trying to access historical inventory data via the GraphQL API. His post, "Feature Request: GraphQL API Access to Inventory Adjustment History", really hit home, and I wanted to break down the problem and potential solutions for you all.

The Problem: Current Inventory vs. Historical Reality

Oliver perfectly articulated the challenge. The GraphQL API gives you the current inventory (`inventoryLevel.available`), but doesn't expose the historical ups and downs. Imagine a product created on October 1st, but only actually in stock on November 1st, 2nd, 24th, and 25th. The API might tell you it's been around for 75 days, but that's misleading for calculating sales velocity. As Oliver pointed out, basing your sales velocity on "days since creation" can lead to some seriously skewed business decisions.

He also noted that the `InventoryAdjustmentGroup` type exists, but there's no query to actually *access* it. Frustrating, right? Especially since the Inventory Adjustment List in the Shopify Admin *does* show this data, teasing us with what could be!

Oliver's Proposed Solutions

Oliver suggested a few ways Shopify could address this:

  1. A GraphQL query for `inventoryAdjustmentGroups` with filtering options.
  2. A new field in `InventoryItem` or `ProductVariant` that returns historical `available` values.
  3. Direct access to the data already in the Admin's Inventory Adjustment List.

He even proposed a query structure:

graphql
inventoryAdjustments(
 inventoryItemId: “gid://shopify/InventoryItem/123”
 first: 250
 after: “cursor”
 createdAtMin: “2025-01-01T00:00:00Z”
 createdAtMax: “2026-01-14T23:59:59Z”
 ) {
 edges {
 node {
 createdAt
 delta
 availableAfterChange
 reason
 }
 }
}

The Current Workaround (and Its Limitations)

Unfortunately, as Alsok pointed out in the thread, Shopify's API is optimized for transactions, not historical analysis. So, what can you do *now*?

Alsok suggested tracking inventory changes yourself, which involves:

  1. Subscribing to the `inventory_levels/update` webhook and persisting each change.
  2. For historical backfill, using the REST Admin API inventory adjustments endpoint and reconstructing availability over time.

This is definitely a viable workaround, but it's not ideal. It means you're responsible for storing and managing this data, which adds complexity to your setup. It also requires some coding chops to implement correctly.

Why This Matters and What You Can Do

Ultimately, having access to historical inventory data is crucial for making informed decisions about your business. Knowing when products were actually available helps you understand true sales velocity, optimize inventory levels, and forecast demand more accurately.

While we wait (and hope!) for Shopify to implement a more direct solution, the webhook approach is your best bet. Consider using a service that simplifies webhook management and data storage to ease the burden. Also, make your voice heard! Head over to the Shopify Community and add your support to Oliver's feature request. The more people who request this, the higher the chance Shopify will prioritize it.

It's a bit of a pain to set up, I know, but for accurate analytics, it's worth considering. Good luck, and let me know in the comments if you've found any other clever workarounds!

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools