Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I want to add a step where Flow will check if a product metafield is not one of the values from a list of values. For example if my product metafield is colors, I want to make sure the product metafield is not one of these (ie blue, green, purple, red, orange...). The list will probably be very large and variable so I need a way to store it somewhere and be able to change it as well. Is this able to be done in run code? And if so, can I get an example of how (have never used run code before) ? Thanks!!
KIndly drop your webiste URL
Hi There,
You can certainly use "Run code" to achieve this. The JavaScript would be:
const denylist = [
'blue',
'green',
'purple',
'red',
'orange'
];
export default function main() {
return { denylist: denylist };
}
With the "Define outputs" section as:
"The output of Run Code"
type Output {
"Colour denylist"
denylist: [String!]!
}
This could then be used in a condition compared against a metafield (here I'm using a product variant metafield `custom.colour`):
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025