Variant Metafield update last on flow wins

waynevanrooyen
Shopify Partner
7 0 0

I am stumped by this scenario i have a workflow that when a variant is added it checks to see if the variant has a size option if so then checks to see if the size is S, M, L etc if it find the for example i want it to write a custom html table with dimension for that size in the metafield of the variant. What i am seeeing is the flow runs but the last one that is run is the one that wins and populates all the variant metafield, and what i mean by that is if there are S, M, L
then all the flows run but in the end result all the variant metafields with have the size information for the L variant.

lost ass to why this happens in my head the flow seems logical ass i would program in C#, can anyone enligthen me on why its doing this. I originaly had all in one flow So if S then if M then and it did this then i changed it to run as separate flows and it does same

Thanks

1.png2.png

Replies 7 (7)

paul_n
Shopify Staff
1012 133 242

What is in that condition? I would not run this via separate workflows. More likely, this workflow is running for all variants and not just the "S" variant.  Did you look at a workflow run to see if it's calling the action even if it's not a "S"?

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.
waynevanrooyen
Shopify Partner
7 0 0
It Checks to see the size if S then should write the small size chart etc
But it doesn't do this it seems last one is wins situation
paul_n
Shopify Staff
1012 133 242

I need to see a screenshot of your condition as it's likely configured incorrectly.

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

The condistion just checks to see if each item is a particular size if it is then on then element the code html should be written to the metafield for that variant. Whaat is not making sense to me is if it find an S then it should write the small size chart and if M then medium size chart, but it doesnt do that it write the same size chart to that of the last one find so if the largest size is XXL then XXL chart is even written the S size. As a programmer in C# this doesnt make sense to me at all very confused.

 

1.png

paul_n
Shopify Staff
1012 133 242

You are looping over product / options twice. So this is independently checking if any option name is Size. And if any option value is S.  You want to check if a single option has a name of Size and a value of S.

 

If you click that first "add criteria for same list item" link, you can add a check for the value for the same option. Make sure to select "option_item" when you choose the variable there. Then delete that second criteria. 

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

Hi Paul,

Thanks for assisting with this but i am totally lost as to what you are saying i need to do, i know a lot to ask but can you do a screeny of what my check if conditions should look like.

Thanks

paul_n
Shopify Staff
1012 133 242

Delete the second condition

Click Add criteria for same item

Choose "option_item" (not option), AND, and then values 

Add the check for S

 

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.