Dynamic code for discount in email

Dynamic code for discount in email

Aurimka
Tourist
3 0 3
I need advice on email campaigns in shopify. The newsletter is set up in app flow. How can I add the same code to the code for discount reminder email that was sent in the first email? Provided that the code is dynamic and a unique code is generated for each recipient. I will be grateful for your help)
 
Replies 5 (5)

Dotsquares
Shopify Partner
390 25 52

Hi @Aurimka ,

 

It sounds like you’re using Shopify’s Shopify Flow app to automate email campaigns, and you want to ensure that the same unique discount code from the first email is included in the discount reminder email. Since Shopify Flow doesn’t store previous discount codes natively, here’s a way to achieve this:

 

Solution: Store and Reuse the Discount Code

 

  • Use Shopify Flow to Generate Unique Discount Codes: In your first email, you likely used Shopify Flow to create a unique discount code per recipient. Make sure you store this code somewhere that you can access later.

 

Store the Discount Code in Customer Metafields

 

Since each recipient gets a unique code, you can save it to a metafield on the customer profile:

 

Use a Shopify Flow action to add the discount code to the customer's metafields.

 

Example metafield: customer.metafields.custom.discount_code

 

Retrieve the Discount Code in the Reminder Email

 

When setting up the discount reminder email, retrieve the stored code using Liquid:

 

Your exclusive discount code: {{ customer.metafields.custom.discount_code }}

 

This ensures that each customer gets the exact same code in both emails.

 

Hope these steps will help you, let me know if you need any help.

 

Regards,

Dotsquares Ltd


Problem Solved? ✔ Accept and Like solution to help future merchants.


Shopify Partner Directory | Trustpilot | Portfolio
Aurimka
Tourist
3 0 3

Thank you for your response. I've already done this, but I got to the point of updating the metafield and I don't know what exactly I need to specify in the Value field. Since the code is dynamic, should the Value field contain a variable or a static value of the code name? 

Dotsquares
Shopify Partner
390 25 52

To manage the customer text metafield, you have to create a program to write the dynamic code into the created metafield, and you can manage it from there. if you have any queries, feel free to ask us.

Dotsquares Ltd


Problem Solved? ✔ Accept and Like solution to help future merchants.


Shopify Partner Directory | Trustpilot | Portfolio
Aurimka
Tourist
3 0 3

What should this program look like and where can I create it?

Abel_Lesle
Shopify Partner
233 2 17

@Aurimka , wanted to check in here and see if you were able to work out a solution for this one? If not I think this can be done through flows (but there's a limit of upto 1000 customers in that)

 

But before I dive deeper - wanted to ask, what's the email platform you use to build your campaigns. You mentioned "app flow" so I'm assuming Klaviyo. But I wanted to be sure.

 

Thanks,

Founder
Dollarlabs: Ultimate Discounts (5★) – If you can think of a discount, you can build it
Dollarback: Cashback & Loyalty (5★) – Simple cashback. Powerful loyalty.