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`):
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024