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`):
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024