Auto Hide Products that are Out of Stock in last 90 days

Auto Hide Products that are Out of Stock in last 90 days

7 0 1

Hi, i'm trying to customize standard automation of shopify flow to hide out of stock products. 

I need to autohide not all products but only the ones that are out of stock after over 90 days, so customers can eventually preorder meanwhile the products is restocked.


I think that a variabile that i can consider is updated_at, but i don't know how to use it.


Can you help me?


thank you

Reply 1 (1)

Shopify Staff
1188 144 279

Shopify doesn't store the dates when a product or variant goes out of stock. You could do that by setting a product metafield (you would need to define that metafield first through the Admin, something like a out_of_stock_date). The problem after that is that you cannot yet query by metafields. So you might need to use tags instead (which you can use in a query), setting it to something like "nostock_02_28_24").  Then you can use a "Get product data" query to get products that were expired 90 days ago (using tag:nostock_12_28_23). You'll need to write some liquid to get the write tag/date.

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.