Archive Shopify Products if Sold Out for 30 Days

5 min setup
No coding required
Runs automatically

Keep your storefront tidy and shopper-friendly by automatically archiving products that have been sold out for 30 days. As soon as a product goes out of stock, this template begins tracking it. If the product is still unavailable after 30 days, MESA will update its status to Archived. When you install this template, it will also install the 'Track Out-of-Stock Shopify Products' template. Both workflows must be enabled for the archive process to work correctly.

schedule icon
Schedule
Query Database for Long-Term Stockouts
Loop Through Products
Update Database Record
Shopify logo icon
Archive Product in Shopify

You're in good company

"MESA has been a game changer for us. And, if you ever get stuck, their support team is always super helpful."

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
PetFriendly

"It's like Zapier but exactly designed for Shopify. I have been able to complete all the workflows that I've needed."

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
Zailys

"The MESA team has been amazing at helping us set up our automations. We would highly recommend this app!"

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
Rothy's

How it works

5 steps to automatically archive products that stay sold out for 30 days

schedule icon

Schedule

App connector: Schedule • Time to complete: 1 minute
Why this matters: This trigger runs the archiving check daily at a consistent time, ensuring long-term sold-out products are removed from your storefront regularly without manual oversight.

This scheduled trigger runs once per day at your configured time (default is typically midnight or early morning). It initiates the workflow that checks the "Sold Out Shopify Product Tracker" database for products that have been out of stock for 30 or more days. You can customize the schedule frequency and time in the trigger settings to match your business needs.

Query Database for Long-Term Stockouts

App connector: Data • Time to complete: 1 minute
Why this matters: Identifies which products have been completely sold out for 30+ days by querying the tracking database, ensuring only chronically unavailable products are archived rather than items with temporary stockouts.

This step runs a SQL query against your "Sold Out Shopify Product Tracker" table to find products where Status = "Active" (not already archived) and the Sold Out Start Date is 30 or more days in the past. The query calculates the day count by comparing the current date to the Sold Out Start Date and returns only records that meet the 30-day threshold. Results include Product ID, Product Title, Sold Out Start Date, and Sold Out Day Count for each product that qualifies for archiving.

Loop Through Products

App connector: Loop • Time to complete: 0 minutes (Auto-configured)
Why this matters: Processes each qualifying product individually, allowing the workflow to archive multiple products in a single daily run rather than handling only one product at a time.

This loop step iterates through each record returned by the database query. For every product that's been sold out for 30+ days, the loop executes the subsequent archiving and database update steps. The loop processes products sequentially until all qualifying products have been archived and their records updated.

Update Database Record

App connector: Data • Time to complete: 0 minutes (Auto-configured)
Why this matters: Marks the database record as "Archived" and records the end date, creating a complete history of the sold-out period and preventing the workflow from attempting to archive the same product again on subsequent runs.

This step updates the corresponding record in the "Sold Out Shopify Product Tracker" table by setting Status to "Archived" and Sold Out End Date to the current timestamp. The record now shows the complete sold-out lifecycle from start date to end date. Changing the status to "Archived" ensures the next daily run won't find this product in the query results, preventing duplicate archiving attempts.

Shopify logo icon

Archive Product in Shopify

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Removes the long-term sold-out product from your online store automatically, improving customer experience by eliminating unavailable products from search and browse experiences.

This step updates the product status to "archived" in Shopify using the Product ID from each loop iteration. Archiving the product removes it from your online storefront and collections while keeping it in your Shopify admin for future reactivation. The product remains searchable in admin and retains all its data (images, descriptions, variants) so you can easily unarchive and republish when restocked.

Ready to set this up? It only takes 5 minutes.

Our support team will even help you personalize this workflow for free.

Get started →

Make it your own!

Customize this workflow even further:

Adjust the 30-day threshold
Modify the database query to use a different day count (like 14, 60, or 90 days) based on your product types, restock timelines, and how long you want to show unavailable products before archiving.
Send notifications before archiving
Add a Slack or email step before the archive action to notify your team which products are about to be archived, giving them a chance to expedite restocking or make exceptions for high-value items.
Archive only specific product types
Add a filter after the loop that checks product type, vendor, or tags and only archives products that match certain criteria, allowing you to keep some sold-out products visible (like limited editions or seasonal items).
Create restock reminders
Instead of or in addition to archiving, add a step that creates tasks in Asana or sends vendor emails for products that have been sold out for 20+ days, giving your team time to restock before the 30-day archive threshold.

Common questions

What if a product gets restocked before the 30-day mark?

Can I change the 30-day threshold to something shorter or longer?

What happens to archived products in Shopify?

Ready to automatically archive products that stay sold out for 30 days?

7-day free trial • 5 min setup • Cancel anytime

Need help? Our automation experts will help you personalize this workflow for free. Contact support