Computes each product's on-hand inventory value at cost (sum of unitCost times quantity) and writes it to custom.inventory_value for reporting.
async def run(ctx): for product in await ctx.shopify.query(ALL_PRODUCTS): value = sum((v.unit_cost or 0) * v.inventory for v in product.variants)
How do you get an inventory value report per product on Shopify?
To get an inventory value report per product on Shopify, this template multiplies unit cost by on-hand quantity for every variant, sums it per product, and writes the result to custom.inventory_value. Reports, dashboards and exports then read a number that actually exists instead of recomputing it in a spreadsheet each month, and the same field can drive rules: flag products holding more than a threshold in tied-up cash, or sort a buyer's view by capital at rest.
Shopify's own inventory reports live in analytics as snapshots you read; a value that feeds, exports and other automations can consume per product has to live on the product itself. Refreshed on schedule, the metafield tracks receiving and sales automatically. Each run's report lists every value it would write, which is also the fastest way to spot a cost field someone fat-fingered.
Last updated August 24, 2026
If you run a sharper version of this template, or something it inspired, send it in. We review every application and publish the good ones, credited to you or your agency.
AI writes real Python or TypeScript, a dry run rehearses it, you approve, it deploys.
Free plan · no card · 🇪🇺 EU data residency