Use Metafield Comparison in Low Inventory Flow

BarnabyT
Visitor
1 0 0

Hi-

 

We have different products that need to trigger low stock warnings at different inventory levels, and we have those set in a custom metafield on our products (called 'Low Stock Warning'). I found the template for 'Get notified by email when product variant inventory is low', but that only lets me set a single number for all products. Is there any way to adapt that to use the number stored in the metafield as the point of comparison instead? I tried looking at the various metafield options, but I'm very confused...

Replies 2 (2)
paul_n
Shopify Staff
Shopify Staff
604 97 154

The problem you'll run into is that metafield values appear as strings to Flow. So you can't compare them as numbers except in liquid. We are working on some improvements to this so you can use the metafield like this.

 

If your logic can live in an action via liquid, for example to control what is show in a notification, you could do this. But if you need to control sending the email, you'll need to wait. 

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
136 3 21

Since this isn't possible currently in Flow, I thought I'd recommend our automation app mesa as a solution here. I could build you out a template for this if you were interested.

Kalen Jordan
Platform Advocate
MESA - Shopify Automation You've Love