Using Flow to validate discount codes

We’re currently using Flow to validate certain tags and metafields on orders. Because we’re using Code Bulk to generate redemption codes, I also want to check which list the promo code was from and tag each order appropriately.

If the codes are in a downloadable csv, what’s best practice for storing them so Flow can run a lookup?

You could put them in a shop metafield or metaobject. Or you could put them in Run code. Probably depends on how you want to update them over time.

Run code is simpler but better if you don’t need to update them again.

Metaobjects or metafields can be updated in the Admin or programmatically

We get around 200-500 new codes per month, no expiration date. Ideally what I could do is check a list and add a tag by campaign, so later we can easily run reports to see performance against each campaign tag if that makes sense.

If the codes have to be use at all on the frontend probably use a JSON type mf to have property like behavior in theme-liquid.

To get the codes INTO shopify somehow :trade_mark:
Use the products CSV import to import the codes as literal products(handles that are prefixed to manage easier, and or collections, and or product tags)
.e.g. discount-123abc
→ flow > convert product handles to store metafields/metaobject ← flow reads store level mfs’s or mobs
optionally deleting the info-products.
:bomb: Test and keep in mind any multi-channel/downstream process that might auto consume products

I wouldn’t call it a best practice but it is makedo while building a fleshed out solution.

We’ve got the codes loaded and discounting appropriately. This is just for tagging and validating on the back end (for ex., flagging if one customer is using x number of codes per promotion). As other Paul mentioned above, a metaobject seems like the best go-forward path, so we’re working towards that with an idea of updating from Code Bulk > Admin, where Flow can do the required checks.

1 Like

By Code Bulk do you mean discountredeemcodebulkadd? https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountredeemcodebulkadd
Then yeah it’s a straighter shot if already using the api.
Otherwise the products CSV import is there as an indirect bulk data entry method and flow could convert the info into MOBs.

Let us know how it goes, Good Hunting.

Yeah I should have clarified with the link, we’re using this app Code Bulk Discounts - Generate and export unique bulk discount codes | Shopify App Store