Classifies each active product by its highest variant price into exactly one of the tags 'budget', 'mid', or 'premium', removing the other band tags.
async def run(ctx): for product in await ctx.shopify.query(ACTIVE_PRODUCTS): top = max(v.price for v in product.variants)
How do you segment products by price range on Shopify?
To segment products by price range on Shopify, this template reads each active product's highest variant price and assigns exactly one band tag, budget, mid or premium, removing the other two so no product ever carries a contradiction. The band edges are parameters: set budget below 50, premium above 200, or whatever fits your catalog's spread. Collections, search filters and ad segments can then treat entry-level and flagship products differently without anyone maintaining lists by hand.
Prices move and bands do not follow: that is how a product repriced into premium keeps its budget tag for months, discounting your flagship in every filtered view. Re-run on a schedule, the classification follows the price the day it changes. The report lists every product changing band with its old and new tag, which makes a repricing wave easy to sanity-check in one read.
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