How can flow be used to indicate an uncompleted metafield during product listing?

How can flow be used to indicate an uncompleted metafield during product listing?

jake_mitchell
Shopify Partner
120 2 61

Hi, 

 

We sell a lot of one off items, with a lot of different people listing the stock. 

 

There is something that we want to be recorded as either YES, NO or TRUE, FALSE against each listing and for this to be mandatory. 

 

We can't make certain metafields mandatory during listing so the next best thing is to use flow to make sure we can pick up instances where an item has been listed without this metafield being completed. 

 

I've tried to set up a flow where 

 

trigger = product added to store

condition = match metafield namespace/key and value is not equal to true or false

action = send internal email

 

I've tried setting up the condition in a number of different ways but can't get this to work. 

 

The question: is there a way to use flow to highlight when a metafield hasn't been used during product listing? 

 

jake_mitchell_0-1658824825886.png

 

Replies 9 (9)

paul_n
Shopify Staff
1336 151 306

I think you want to check if `at least one of the metafields` has a value that is `is at least one of` of those True/False/ values (hit "enter" for each value to add them like tags). 

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.
jake_mitchell
Shopify Partner
120 2 61

Thanks so much for taking the time to reply. I've tried that but it doesn't seem to work, for sligthly different reasons.  

The flow seems to be failing for a few reasons. 

1. It isn't recognising the namespace and key despite them being correct. It is picking up my_fields.top_level_category  - that is a metafield that does have a value in it. 

2. The bit where it should recognise that the value is not True or False is showing as pass but is doing so incorrectly as it is looking at the value of the wrong metafield - my_fields.top_level_category

jake_mitchell_0-1659102494877.png


Any ideas? 

paul_n
Shopify Staff
1336 151 306

 

It's very likely that you have not set this up right. Can you post an image of your condition panel expanded? 

 

Two notes

  • you cannot add a custom array to that value field. It will treat that like a string.

  • in conditions, you are looping over all the metafields and then checking if a field matches one of the metafields in that loop. You need to add the checks for namespace/key/value to the same level. 
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.
jake_mitchell
Shopify Partner
120 2 61

Of course. Thank you for helping. 

jake_mitchell_0-1659107575640.png

is that what you need? 

 

I also tried setting up a similar metafield as single line of text with two values of yes/no

jake_mitchell_1-1659107653770.png

 

That didn't work either. 

 

paul_n
Shopify Staff
1336 151 306

A couple of more questions...


What type of metafield are you using? Boolean? 
By testing for True/false, what are you trying to test for? That it's empty?

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.
jake_mitchell
Shopify Partner
120 2 61

I have tried using a boolean true/false metafield 

jake_mitchell_1-1659109776407.png

And also using 'single line of text' with Yes/No values

jake_mitchell_0-1659109750774.png

 

In both instances i am trying to check whether the product has been listed without a value being put in the metafield. 

This would be 100% solved if there was a way of making a metafield mandatory as the person listing would have to engage with it. But until that is the case we need these sort of workarounds. 

 

paul_n
Shopify Staff
1336 151 306

Thanks. I tested this on my side with the boolean type. It comes through as true or false (case sensitive). I'd recommend that you change the "not equal to" to "is at least one of" and list "true" and "false" in the value. If it hits the "otherwise" path then that value is blank.

 

There is a second thing that causes this message:
metafields item value = There is no value.

This could be because none existed or the variable is nested too deep to be returned.

 

If the object has no set metafields, then the list of metafields will be null. If you use "at least one of product/metafields" like now, then when that happens the condition will be false. So that part should work without changes.

 

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.
jake_mitchell
Shopify Partner
120 2 61

Hi, 


Thanks for you help. The flow now sends the email, which is great. I then tested it again after inputting something into the metafield and it still sent. So it's still not working but in a different way. 

Will take a look again next week. 

Is there a Shopify feature request thing anywhere? Mandatory metafields would really help us out in a few ways. This being one of them. 

 

paul_n
Shopify Staff
1336 151 306

I've forwarded this thread to the metafield team, so they are aware of the need. 

 

If you could dm me a link to your workflow, that would help this move along faster.

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.