How it works

Follow these 5 simple 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.

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.

Frequently asked questions

What if a product gets restocked before the 30-day mark?
You'll need a companion workflow that monitors inventory and removes or updates the database record when products come back in stock. Without this, the archiving workflow might archive a restocked product if its database record still shows it as sold out for 30+ days.
Can I change the 30-day threshold to something shorter or longer?
Yes, edit the database query in Step 2 to change the day calculation. Replace "30" with your desired threshold (like "14" for two weeks or "60" for two months). The query typically uses a SQL condition like WHERE (CURRENT_DATE - "Sold Out Start Date") >= 30.
What happens to archived products in Shopify?
Archived products are removed from your online store but remain in Shopify admin under Products > Archived. They retain all data (images, descriptions, variants, inventory) and can be easily unarchived by changing their status back to "Active" or "Draft" when you're ready to restock and republish them.
What is a template?
Templates are pre-made workflows by our team of experts. Instead of building a workflow from scratch, these have all the steps needed to complete the task.
Can I personalize a template?
Yes! Every step can be customized to meet your exact requirements. Additionally, you can even add more steps and make it more sophisticated.
Are templates free?
Yes! Our entire library containing hundreds of templates are free to use and customize to your exact needs.

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

Join thousands who've automated their work and saved an average of 3.5 hours every week.

Start with this template — It's free
7-day free trial • 5 min setup • Cancel anytime