Tags active products whose heaviest variant meets or exceeds a weight threshold (default 20 kg) with 'heavy-item' for oversized-shipping handling.
async def run(ctx): limit_kg = ctx.params.get("weight_kg", 20) for product in await ctx.shopify.query(ACTIVE_PRODUCTS): heaviest = max(v.weight_kg for v in product.variants)
How do you handle oversized shipping on Shopify?
To handle oversized shipping on Shopify, this template tags active products whose heaviest variant meets or exceeds your weight threshold, 20 kg by default, so shipping profiles, rate rules and fulfillment routing can key off the tag. It reads every variant, not just the default one, because the single unit clears the courier limit and the 4-pack of the same product does not. Change the threshold and the next run re-draws the line across the whole catalog, and products that slim down below it lose the tag on their own.
Weight edge cases usually surface as a support ticket about an undercharged pallet, and scanning thousands of variants by hand is not a job anyone repeats monthly. Code repeats it happily. The run report names every product crossing the threshold in either direction, so the shipping team confirms the list once and the checkout stops guessing.
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