Create Flow to add color metadata

6 0 0

I'm attempting to create a Flow that's triggered by a product added to store, checks for a color tag such as "primary-black", then updates the metadata of that product to Black.

Screenshot 2024-06-10 112253.jpg


I created a color metaobject that utilizes a title, hexcode, and .jpg when included. 


I used the method that is described in the attached video starting at 6.45.


Color Filters 

Reply 1 (1)
6 0 0

Thanks, I had to adjust the code with a little to get Flow to not throw an error (I'm no coder, had to do a bit of research). Unfortunately, even after Flow accepted the code, after running it I get this error, "Got error updating metafield: "Value can't be blank." For value: "\n\n", Type: list.metaobject_reference".


Here's the updated code:

{% if product.tags == "primary-black" %}
{{ product.tags | replace: "primary-", "" }}
{% endif %}


{% assign product.metadata.color = "Black" %}


Should I be adding each detail from this metaobject; the color name, the hexcode, and whether or not there's a jpg?