Solved

Adding products to a list of products metafield

josu24
Shopify Partner
11 0 0

How can I write to a list of products metafield in Flows?

Skärmavbild 2023-12-13 kl. 11.26.29.png

Accepted Solutions (2)

paul_n
Shopify Staff
799 119 192

This is an accepted solution.

There are several threads on how to do this. Here's one: https://community.shopify.com/c/shopify-flow-app/tags-to-metafield-single-line-list/m-p/2034786

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

paul_n
Shopify Staff
799 119 192

This is an accepted solution.

It might work now, but you have a race condtion and should avoid that-- the actions for update product metafield could run in parallel. Instead, I would put the second action in the "then" path for the For each step. It will run after that loop is done.

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 4 (4)

paul_n
Shopify Staff
799 119 192

This is an accepted solution.

There are several threads on how to do this. Here's one: https://community.shopify.com/c/shopify-flow-app/tags-to-metafield-single-line-list/m-p/2034786

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.
josu24
Shopify Partner
11 0 0

Thanks! I managed to get this to work:

Skärmavbild 2023-12-20 kl. 13.35.25.png

Skärmavbild 2023-12-20 kl. 13.35.42.png

 

 



paul_n
Shopify Staff
799 119 192

This is an accepted solution.

It might work now, but you have a race condtion and should avoid that-- the actions for update product metafield could run in parallel. Instead, I would put the second action in the "then" path for the For each step. It will run after that loop is done.

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.
josu24
Shopify Partner
11 0 0

Alright thanks!
My only problem now is that this query matches both "stylen_ace jacket" and "stylen_ace jacket patterned" when style ="stylen_ace jacket" :

{% for tags_item in product.tags %}
  {% if tags_item contains 'stylen_' %}
     {% assign style = tags_item %}
  {% endif %}
{% endfor %}

tag:"{{ style }}"