Hi, would you be able to use Shopify coupon codes? https://help.klaviyo.com/hc/en-us/articles/115006155388
If not, you have a few options.
You could have a Shopify Flow triggered on placing an order, that fetches the code from your API and sends a custom event to the Klaviyo profile with the code as a property; you’d then have a flow triggered on this event where you can include the code.
If the account has enough profiles to qualify for custom actions — https://developers.klaviyo.com/en/docs/add_a_custom_action_to_a_flow — you could have a Klaviyo custom action step call this API, fetch the code, and set the code as a profile property to be included in subsequent flow emails, or again send a custom event to the profile with the code as a property.
Hello,
This is achievable with klaviyo, first you can setup webhook in shopify so it can trigger when an order is being placed, you can make use of zapier... Identify which virtual bucks product was purchased then you can use the API key and product ID to get the code for that purchase then you can now put in the code into klaviyo as either custom event or custom profile property. After that you can set up flows that trigger in klaviyo. it should be base on the event or updated profile. You can insert code and deliver it to the customer right after their purchase.
I like both @saulblum and @MANSIR2094 various suggestions, either with the Shopify Flow, Klaviyo custom action or a webhook (or zapier/make.com), or possibly via pre-uploaded coupon codes if the code doesn’t have to be assigned to a specific person at the point of creation. (Depends on how your backend system works)
If I had to pick, I would have your system that you have that already waits for the Product Variant purchase (along with the API key) from Shopify be where the business rules lie and the driver of events to Klaviyo.
Since you already have backend logic to “generate a code” that matches the purchase, then all you would have to do is subsequently send a server side custom event to Klaviyo; you can assign in the event payload the redemption code and any other associated data (Item Name, Item’s Image URL, etc). This can all be in one atomic operation to maintain your ledger integrity.
Then you can simply create a Metric Triggered Flow that simply sends a message with the redemption code each time your system send Klaviyo an event that a “virtual buck” was purchased (and created). Basically, think of Klaviyo as the system that receives each the event, and then sends an email to the recipient. All the logic rests in your system to know when and what codes to generate, Klaviyo is a simply a wrapper that just renders it in a nice Template and gives you all the engagement analytics around it after its delivered.
Thanks so much for all your help and suggestions, guys! @saulblum @MANSIR2094 @retention truly appreciated.
A couple of questions:
- Would these solutions work if someone purchases multiple “virtual bucks” products at once? For example, if a customer buys 2 virtual bucks products, how can we ensure the Klaviyo custom profile property doesn’t get overwritten and the customer only receives one code?
- Similar question to above.. if someone buys one “virtual bucks” product, then 2 weeks later buys another “virtual bucks” product, will it be using the same custom profile property? Would it overwrite the old code with the new code?
Thanks!
Uisng a custom event per virtual bucks purchase is your best bet, vs. maintaining profile properties as strings or arrays.
Thank you @saulblum . I’m setting up the Shopify Flow now, but I’m running into an issue. Which action do I use to make the API request? I see the “Send HTTP Request” option is available, however it says the action does not return data, which we will need to retrieve the redeem code. Is there an alternative you were thinking of?
Thanks so much for all your help and suggestions, guys! @saulblum @MANSIR2094 @retention truly appreciated.
A couple of questions:
- Would these solutions work if someone purchases multiple “virtual bucks” products at once? For example, if a customer buys 2 virtual bucks products, how can we ensure the Klaviyo custom profile property doesn’t get overwritten and the customer only receives one code?
- Similar question to above.. if someone buys one “virtual bucks” product, then 2 weeks later buys another “virtual bucks” product, will it be using the same custom profile property? Would it overwrite the old code with the new code?
Thanks!
You are welcome @srdjank ,
Custom events are the way to go for stability and accuracy when it comes to handling multiple purchases and avoiding overwritten data.
And it's better to use a custom event instead. Each code can be passed as a new event like virtual bucks purchase and klaviyo will treat each as it is own data point then you now trigger a flow which sends one email per item/code purchase or even include multiple codes in one email using event arrays .
Thank you @saulblum . I’m setting up the Shopify Flow now, but I’m running into an issue. Which action do I use to make the API request? I see the “Send HTTP Request” option is available, however it says the action does not return data, which we will need to retrieve the redeem code. Is there an alternative you were thinking of?
You’re right, I see that: https://help.shopify.com/en/manual/shopify-flow/reference/actions/send-http-request
Your better bet then would be running code inside a Klaviyo flow, which can parse the response, and send it, say, as part of a new Klaviyo event.