Solved

Querying products with dynamic value using Flow

RossellaF
Shopify Partner
28 0 5

Hi,

 

One of my clients registers an individual product for each color, but in the front end wants to display these separate products as a single one with color variants.

 

Each product has a metafield where the model ID is stored. I was wondering Flow could allow me to grab at a scheduled time this model ID value and query all products that also have this model ID.

Then I would save this list of values in another metafield, so I could reference it from the front end.

 

Is this something that could be done with Shopify flow? There are 2500+ products in the store.

Accepted Solution (1)

paul_n
Shopify Staff
1067 137 254

This is an accepted solution.

You cannot yet query products by metafields, so not possible. 

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.

View solution in original post

Replies 5 (5)

paul_n
Shopify Staff
1067 137 254

This is an accepted solution.

You cannot yet query products by metafields, so not possible. 

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.
RossellaF
Shopify Partner
28 0 5

Hi Paul,

How about using a portion of the SKU and querying the product variants? 

Variant SKU is also not available

paul_n
Shopify Staff
1067 137 254

You *can* query products by SKU. 

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.
RossellaF
Shopify Partner
28 0 5

Gotcha! 
After a For Each action, is it possible to use a piece of data returned by the query, get a substring of it and then use it to make a new query?

paul_n
Shopify Staff
1067 137 254

I wouldn't be doing a query inside a for-each loop or you'll quick hit the 100 limit. That said, you can pass the data from one query into a second query. But if they can just be 1 query, that's even better.

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.