Computes discount depth per product from stock age, sell-through and margin room instead of one blanket percentage, and holds every new price for your approval.
async def run(ctx): for product in await ctx.shopify.query(SALE_CANDIDATES): age = await ctx.inventory.stock_age(product.id) pace = await ctx.orders.sell_through(product.id, days=30) room = await ctx.pricing.margin_room(product.id)
How do you run markdowns on Shopify without a blanket percentage?
To run markdowns on Shopify without a blanket percentage, this template computes discount depth per product from stock age, sell-through and margin room. Slow, old, well-margined stock gets a deeper cut; items that were selling anyway keep their price; thin-margin products never get discounted past their floor. A flat 30% off discounts your winners along with your problems, and the winners are where the margin was. The ladder steps are parameters, so a gentle 10-20-30 season and an aggressive clearance use the same template.
Merchandisers know this logic; applying it across thousands of products every season is what never happens by hand. Computed as code, the whole ladder lands as one reviewable list: every product, its proposed depth and new price. Pull the outliers, approve the rest, and the markdown runs product by product instead of catalog-wide.
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