How can I effectively add a value to a product's Metafield?

fangirlstar
Shopify Partner
10 0 1

Hi,

 

Our store uses product tags that are pushed to Shopify through our POS and we would like to add storefront filtering capability based on one of those tags. It looks like this should be achievable through Flow by creating a trigger event (when product is added to Shopify) and looking to see if the product contains a tag, then updating the meta field. I have got that far in Flow, but it is not adding the desired value to the meta field. I am not getting any errors, it's just not doing anything. I read in a separate forum post that since the value would be the same for all qualifying products that I don't need to use liquid in the "value" field, but maybe this is incorrect? See below screenshot:

 

fangirlstar_0-1712251252220.png

 

 

Replies 10 (10)

lilyliward
Shopify Staff
18 1 8

The first thing to know if the condition is met, i.e., whether or not the tag is added when the workflow is run. If you open a workflow run, what does it show? 

To learn more visit the Shopify Help Center or the Community Blog.

fangirlstar
Shopify Partner
10 0 1

Thanks for the reply. So just to clarify I am not adding a tag. I am using the tag to trigger the event. What I would like it to do is add a value to a meta field (I created) so that it can be used for storefront filtering. But if your question is whether or not the Worflow is running on when the condition is met, then yes. I continually receive succeed on all triggers (see below) Does that answer the question?

 

fangirlstar_0-1712329953664.png

 

paul_n
Shopify Staff
1056 136 249

Have you set up a metafield definition for that metafield and can you see it in the Admin? Some screenshots would help. I'd guess that you are setting the wrong namespace or key and that you aren't seeing it because it's setting an "undefined" metafield that doesn't show up by default. 

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.
fangirlstar
Shopify Partner
10 0 1

Ok, I was thinking it was something along those lines. Below is the meta field 

Also, I have tried adding the name and key in Flow as

Metafield Namespace: custom.condition

Key: custom.condition

 

fangirlstar_0-1712335064705.png

 

paul_n
Shopify Staff
1056 136 249
Namespace is custom and key is condition.



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.
fangirlstar
Shopify Partner
10 0 1

Yes, that is what I have currently. Is liquid required to update the value field or anything along those lines? 

fangirlstar_0-1712341521026.png

 

paul_n
Shopify Staff
1056 136 249

no, that should just work.  You may want to check that you don't have any extra spaces on the ends of those values.

 

If that isn't the problem, might help to contact support so that we can see your workflow run and the resource to confirm what you are saying. You could also drop the screenshots here for the workflow run and product that should've been updated (showing the metafield).

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.
fangirlstar
Shopify Partner
10 0 1

Just checked, no additional spacing anywhere. Here are additional screen shots of workflow run success and the associated product with metafield (still empty).

Screenshot 2024-04-05 133236.pngScreenshot 2024-04-05 133312.png

 

 

paul_n
Shopify Staff
1056 136 249

Ah, you are updating a "product metafield" when you need to update a "product variant metafield". Sorry should've got that one a bit earlier.

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.
fangirlstar
Shopify Partner
10 0 1

Ack thank you! That fixed it.