What's your biggest current challenge? Have your say in Community Polls along the right column.

Create Flow to add color metadata

Create Flow to add color metadata

FeelingLikeASir
Tourist
7 0 1

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 

Replies 2 (2)
FeelingLikeASir
Tourist
7 0 1

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?

Kalen_Jordan
Shopify Partner
798 37 143

You generally can't set metafields to an empty value.