Flow For Unpublishing Products

Topic summary

A user is attempting to create a Shopify Flow to automatically unpublish products from a specific collection when inventory drops to 1 or less. The challenge is running this immediately on all existing products rather than waiting for inventory changes to trigger it.

Initial Approach:

  • Used a scheduled trigger with “Get collection data” action
  • Encountered issues because Flow cannot loop over nested lists (collection products are two levels deep)

Recommended Solution:

  • Use “Get product data” action querying by inventory level (≤1) instead of by collection
  • Implement a tagging system to process products incrementally (add “processed” tag to avoid re-processing)
  • Check collection membership within a conditional statement
  • Limit queries to 50 products per run due to Flow’s loop action limits
  • Run scheduled trigger every 10 minutes to gradually process all products

Outcome:
The user attempted implementation but encountered errors related to missing “for each” loops. After receiving technical guidance, they expressed frustration with Flow’s complexity and decided to pursue alternative solutions outside of Flow.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello,

Here is what I would consider a very easy Flow that I cannot get to work. I would like to run a Flow where all products in a certain collection that have inventory of 1 or less are unpublished from my website. Sounds easy? It’s not for me.

The easy way to do this requires the Product Variant Inventory Quantity Changed as the trigger. But I want it to run now, on all products, not when their inventory level changes.

In my head, the next logical solution would be to set a scheduled to run trigger. I have tried about 3,897,458 variants of this Flow. None work. I would greatly appreciate if anyone could please help me automatically unpublish all items from a collection with inventory levels of less than or equal to 1. Thank you.

You cannot loop over getCollectionData.products as that is 2 levels of lists and For each only supports 1. I suspect you just overrode the description on that task

What you probably would want is a “Get product data” action, but that doesn’t work easily because you cannot query products by a collection (API doesn’t support it).

You could just query products by their inventory and then check the collection in a condition in the workflow. But you’ll need to set it up so that this only runs once per product. To do that, you need to use tags. So you can add a tag to each product when this runs (something like “processed”). And then you add tags_not:“processed” to your query filter. Eventually it will get through all the products.

Workflow would look like:

  • Scheduled time (every 10 min)

  • Get product data (inventory <= 1 + doesn’t have “processed” tag, put a limit of 50 because you need 2 loops later and you get 100 max results per workflow)

  • For each (product in getProductData)

    • Condition: If collection.id = your collection + any other condition
    • True: Unpublish
  • For each (product in GetProductData)

    • Add product tag (processed)

Flow is planning on removing the limit in For each loops on the number of actions per loop…just haven’t done the work yet.

Thank you for the reply. Can you tell me where I went wrong?

I get this error.

The error message tells you the solution. If you look at my previous reply you skipped steps (for each)

Thank you for your reply. I own two retail Christmas stores. I am new to Shopify. I care to become a coder or learn more about Flow about as much as you care to learn about imported German Nutcrackers. Thank you for your help, I’ll find another solution that doesn’t involve Flow or support from Shopify staff.