Sets auto-hidden draft products back to ACTIVE once they have inventory again, removing 'auto-hidden-oos' and adding 'back-in-stock'.
async def run(ctx): for product in await ctx.shopify.query(hidden_by("auto-hidden-oos")): stock = sum(v.inventory for v in product.variants)
How do you republish products automatically when they are back in stock on Shopify?
To republish products automatically when they are back in stock on Shopify, this template finds the drafts its companion hid at zero inventory and sets them back to active as soon as they have stock again. It swaps the auto-hidden-oos tag for back-in-stock, which gives the theme a banner hook and gives marketing a segment to announce. Only products the companion hid are touched, so drafts you parked on purpose stay parked.
The manual version fails in one direction. Hiding sold-out items happens eventually, but remembering to republish them does not, and restocked products sit invisible while their inventory ages. As a scheduled pair, hide and republish close the loop without a human keeping score. The run report names every product about to reappear, so a receiving mistake gets caught before the storefront announces stock you do not have.
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