Mirrors a single-line-text metafield (default custom.badge) into a 'badge:<slug>' tag so a merchandiser-set badge drives theme and filtering tags.
async def run(ctx): field = ctx.params.get("metafield", "custom.badge") for product in await ctx.shopify.query(ALL_PRODUCTS): badge = await ctx.metafields.get(product.id, field) wanted = f"badge:{slugify(badge)}" if badge else None
How do you manage product badges on Shopify?
To manage product badges on Shopify, this template mirrors a single-line metafield, custom.badge by default, into a normalized badge tag. A merchandiser types one value on the product; the tag then drives the theme's badge rendering, storefront filtering and any collection logic, and nobody keeps field and tag in sync by hand. The mirror normalizes as it copies, so "Limited Edition" and "limited edition" produce one tag, not two filters.
Badge systems rot when the metafield changes and the tag stays: a "limited" badge on a restocked evergreen, a "new" flash on a two-year-old product. Because the mirror re-runs across every product, renamed and cleared badges propagate on the next run, and the report shows each tag change before the storefront does. The merchandiser keeps one field to think about; everything downstream follows it.
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