Shopify Analytics already calculates days of inventory remaining per product variant (visible in the “Products by days of inventory remaining” report, using 30-day sales velocity). However, this metric is not accessible in Shopify Flow.
Requested feature: Add a Flow trigger or condition that fires when a product variant’s days of inventory remaining crosses a defined threshold (e.g. “less than 35 days”).
Use case: Automatically send a restock alert email when a specific product — filtered by collection — drops below a set number of days of inventory, based on actual sales velocity rather than raw unit count.
This would make Flow significantly more useful for inventory management without requiring third-party apps. The data already exists in Shopify — it just needs to be surfaced in Flow.
Good idea overall, but it’s better to contact support to suggest new features.
Just in case – there is no direct way to get report data in Flow.
There are, however, ways to do this with direct call to GraphQL API via “Send HTTP request” action (full setup is a bit too complex for a forum post).
So, technically, you can fetch report data daily, process it and send notifications/add lines to Google Sheet.
Here is a screenshot from my flow to get “last month bestsellers” which should be very similar to what you need:
Days of inventory remaining is just a random estimate. It is just based on the last 30 days of sales. As a result it is not considering seasonality or other factors in those calculations.
Just to give an idea, it is not even taking a simple lead time into account when calculating your restock point. It might be better to use apps for this until such calculations available.
Stock Control app, for instance, follows those factors for you and send reminder.
FYI, Flow is rolling out a “Get analytics data” action (today) that may allow you to access the ShopifyQL inventory data without using Send HTTP request.
+1 to Paul’s last suggestion. Gave this a try and wanted to share what worked for me with the new ShopifyQL method.
Here’s the high level:
Create a new Flow and use a scheduled trigger (e.g. daily)
Add an action for ‘Get analytics data’ and paste the query below (or tweak to your liking)
Set your downstream action (e.g. send an email, fire Slack alert, etc)
The trick is to get the query right. This is what worked for me. It’s based on the same logic as Shopify’s native “Product by days of inventory remaining” report OP mentioned. I slightly modified it so that it returns the actionable products (not the full list) and stripped the visuals display (since it’s not needed for the flow). So this uses the same method as the report (30 days of sales data) and focuses on products running out within 14 days (tweak to your liking).
Here is the query:
FROM inventory
SHOW ending_inventory_units, inventory_units_sold_per_day,
days_of_inventory_remaining
WHERE inventory_is_tracked = true
GROUP BY product_title, product_variant_title, product_variant_sku
HAVING inventory_units_sold_per_day > 0
AND days_of_inventory_remaining <= 14
SINCE startOfDay(-30d) UNTIL today
ORDER BY days_of_inventory_remaining ASC
The one catch with this method: it’s a scheduled flow, not a live trigger condition. Right now ShopifyQL is only an action, not a trigger. So you’d have to set this up as a recurring run (e.g. a morning report). If you want something that’s more real-time, as soon as stock crosses a line, then that’s a bit trickier. It is actually possible to do that via Flow too, using metafields. It’s a bit trickier to set up though. Happy to share more on that method if curious
Personally I’d like the ability to change the number of days the report calculates sales velocity on as 30 days isn’t remotely enough for our business. A year would be better at least.