How can I remove a specific metafield value in Shopify Flow?

Hi,

in the theme I’m using, I have the option to display badges that are added via a metafield named custom.badges. The type of this metafield is list.single_line_text_field. In Shopify Flow, I would like a “new” badge to be added to newly added products, and then after 30 days, remove the value of this metafield, which is “new”, without removing the metafield itself, because it may contain other values, like “bestseller”.
I can only replace the “new” value with another one, but I just want to remove it. I can update the value by adding an array [ “badge1”, “badge2” ], but I’m unable to remove a specific value.

Best regards

This might be easier if you use the Run code action. Here’s an example of how you can build a list: https://github.com/Shopify/flow-code-examples/tree/main/run-code-examples/product-tags-to-metafields

Otherwise, you’ll need to use Liquid to remove “badge1” from that list. That will be tricky because you also have to handle commas/brackets/etc.

1 Like