Re: Flow: Remove Product From Channels When Inventory Hits Zero

Flow: Remove Product From Channels When Inventory Hits Zero

jodiabaazar
Tourist
13 0 2

NOTE: I AM FAMILIAR WITH The SHOPIFY TEMPLATE WHICH AUTOMATICALLY HIDES PRODUCTS & ADDS TAG OUT OF STOCK WHEN A PRODUCT / VARIANT GOES TO ZERO. 

 

I am having an issue with flow. I want the following work flow: 

 

1. At a scheduled time, i want flow to scan the complete inventory in all of my products. 

2. I want it to find all products / variants with zero inventory. 

3. I want flow to automatically remove it from ALL CHANNELS (shopify template just removes from online store). This is important because we have apps, affiliate, etc who can still see this product and take orders. 

 

Does anyone know how to do this step by step. FLOW requires a PHD in data sciences to use for even such basic tasks. 

Everyday. Low Price.
Replies 7 (7)

Kalen_Jordan
Shopify Partner
704 30 118

Scanning all of your products would be tricky. It can only grab 100 records at a time generally for all data fetches. Do you have more than 100 SKUs?

jodiabaazar
Tourist
13 0 2

We have close to 8500 active SKUs with 20-30 to be deactivated daily and new ones take their place. Happens in grocery all the time. So it's a very time consuming labor intensive process to consistently remove inventory from all channels. 

Everyday. Low Price.
paul_n
Shopify Staff
1318 148 300

What exactly do you want to find? Products where all of the variants are sold out? Or any variant that is sold out? Probably the prior? 

You can use the Get Product Data action to get products that have 0 inventory (either "inventory_total:<=0" or "out_of_stock_somewhere=true", which finds products out of stock in at least 1 location).  

 

The workflow looks roughly like:

Scheduled time trigger

Get product data

For each (<get product data>)

   Condition: If all variants are out of stock:

      Unpublish product

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Kalen_Jordan
Shopify Partner
704 30 118

Is there a way to paginate through a large number of products on a schedule. Should be possible with a 10 minute schedule to get through 14k products in a day, but I wasn't sure how to paginate since you can't get the pagination cursor in the get product data action?

paul_n
Shopify Staff
1318 148 300

You need to hack your own pagination for that use case by doing something like setting a tag on all the products you processed (and checking if any fetched products do not have that tag). 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Kalen_Jordan
Shopify Partner
704 30 118

Oh nice hadn't thought of that. That's not a bad idea at all.

Kalen_Jordan
Shopify Partner
704 30 118

If you'd like any help getting this flow set up on a paid basis, feel free to reach out. Links are in my footer signature.