Recomputes the net selling price of every variant with sale prices and stacked discounts applied, and tags products at or below cost with 'below-cost'. The first dry run is the audit itself: a list of loss-makers, nothing written.
async def run(ctx): products = await ctx.shopify.query(ACTIVE_PRODUCTS) for product in products:
How do you find products selling below cost on Shopify?
To find products selling below cost on Shopify, this template recomputes each variant's net selling price with sale prices and stacked discounts applied, compares it to the cost per item, and tags products at or below cost. Discounts get set in different places by different people: a compare-at sale here, an automatic discount there, a stacking code from last quarter still live. Nothing native re-multiplies them against cost across the catalog, so the losses hide in the overlaps.
The first run is the audit itself: a list of every loss-making variant with the math shown, produced without writing anything. From there you decide what happens: fix prices, retire a discount code, or apply the below-cost tag so feeds and campaigns stop pushing the loss-makers. Pairs naturally with the margin tagger, which bands the products this audit proves are healthy.
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