Shopify Flow how to add product metafield based on a product tag

We are trying to have certain product tags automatically go to a metafield that adds a label to products.

On our theme we have an extra product label to show last one, clearance etc. We currently have these in product tags which is easier to manage for bulk editing.

I want to create a Flow Workflow so that:

If product tag is LAST ONE

Add the metafield theme.label LAST ONE

There’s s similar starting template to use as a base that checks a tags prefix to to add the affix to a metafield.

Tempalte: Update a product metafield if a product tag has a certain prefix

https://shopify.com/admin/apps/flow/web/editor/templates/908286d2-3e4c-4d9d-8e28-3cf9b12db4df

While you can manually run flows against products by selecting them in the product admin you will probably want to either modify the trigger or setup similar flows with different triggers either scheduled-time or product-status-updated (just quickly unpublish/republish sets of products to trigger it).

At this time there is no product-tags-.. triggers you would need an app like mechanic to do it that way https://learn.mechanic.dev/platform/integrations/shopify-flow .

If you need this flow created for you then contact me directly by email for services.
Please always provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.

Thanks I have set it up as schedule > get product data for tag:LAST ONE

But I am having problems adding the metafield value

I am using:

Update product metafield

Metafield namespace: theme.label

Key: theme.label

But under value I have added the variable to add the value (which I want to be LAST ONE) but don’t know how to edit it properly:

{% for getProductData_item in getProductData %}
{% for metafields_item in getProductData_item.metafields %}
{{metafields_item.value}}
{% endfor %}
{% endfor %}

I am getting a bunch of errors saying: Expected “product_id” to be String but got Nil.

Metafield namespace: theme

Key: label

In the value no liquid logic just use: “LAST ONE”

If you know the exact value and it’s always the same hardcode it.

You should loop over those products returned by Get Product Data with a For Each loop. Then you can set a product metafield for each product.