Converts every variant's weight (value and unit) to a single target unit (default GRAMS) for consistent shipping rules and channel feeds.
async def run(ctx): target = ctx.params.get("unit", "GRAMS") for variant in await ctx.shopify.query(ALL_VARIANTS):
How do you normalize weight units on Shopify?
To normalize weight units on Shopify, this template converts every variant's weight to a single target unit, grams by default, changing value and unit together so 1.2 kg becomes 1200 g and never 1.2 g. That paired update is the whole point: the classic manual slip is switching the unit dropdown without recomputing the number, which turns a jacket into a feather. Mixed units accumulate through imports and suppliers until half the catalog weighs in grams and half in pounds.
Every consumer of weight data suffers from the mix. Shipping rates computed over mixed units come out quietly wrong in both directions, and channel feeds that expect one unit reject or misprice the rest. The conversion runs across all variants in one pass, with each before-and-after pair listed in the run report, and the catalog comes out speaking one unit everywhere.
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