Skip to main content

I created a coupon code for my Newsletter subscribers that expires in 7 days after someone subscribes but when I go to add coupons, there is no option in the dropdown menu to add coupons so does this mean that the coupons will automatically be generated in my email flowswithout the need to add coupons?

Hello @jess,

Thanks so much for sharing your question with the Klaviyo Community.

Yes, that is exactly correct. For coupons that “expire in X amount of days/hours” there is no need to generate codes, they’ll automatically be created as the emails are being dispatched.

If you're planning to send a coupon code in a campaign, I recommend giving the coupon a defined end date and then adding codes.

Also, you can include a tag in your email to notify folks when the coupon is expiring. For example, if the coupon expires in 7 days from today, the tag would look like the following:

{% today '%Y-%m-%d' as today %}
{{ today|days_later:7 }}

Thanks and have a great day.


Hey @dov.derin thanks for the tip. Is there a way to format the displayed date in the format DD-MM-YY? I had a go at moving around the to %d-%m-%Y but it doesn’t seem to work. 

And can I confirm that that would create a dynamic date that will change depending on when the person receives the email within a flow? I am using this as a coupon expiry date in an abandon cart flow. 

 

Thanks,

Viki


Hello @vikiohagan91,

Thanks for your reply. No problem at all - glad I could help.

Yes, I recommend checking out how to play around with the order of dates in our article here

For a full list of date format options, reference Django’s date format documentation

Yes - that is correct the date will change depending when the user receives the email.

 


Hey @dov.derin  Thanks so much for sharing that! This doesn’t seem to work for the piece of code you provided above. When i change the documentation to follow new date codes ie: 

{% today '%d-%M' as today %}
{{ today|days_later:7 }}

It either breaks the block and you can’t save it or it just defaults back tot he format Y-m-d or doesn’t let me save the block at all!

Any advice on how to fix? 

 

Thanks.

Viki
 


Hello @vikiohagan91,

It actually doesn’t appear you have code reformatted correctly. Instead of actually moving those syntax around, you’ll actually need to apply a filter to allow the date to be calculated in the future, but also to be formatted in a different method.

If you wanted to re-order the code to display a date that is 7 days since the email has been received while being in the format of DD-MM-YY, you’ll want to use the following:

{% today '%Y-%m-%d' as today %} {{ today|days_later:7|format_date_string|date:'n-j-y' }}

Have a great day!

David


Hello, so I have a question I created a dynamic code for my abandoned cart that expires 1 day after the customer receives the email but it is no longer generating the coupon code when I send the test email. it just says my coupon code and at the end it says preview. will it show the customer the coupon code when they get the abandon cart email or will it show preview as well. When I had the coupon set to no expiration date I got the coupon code now I don’t. 

 


Hi @ehenderson

 

Thanks for sharing your question with us! Love the idea to incentivize customers to complete their purchase with a coupon code! 

 

I can see that you have also asked a similar question in a topic you started and have received a reply. I’d check out what a team member responded with already in your thread below: 

 

Thanks for being a part of the Community! 

-Taylor 


Hello @vikiohagan91,

It actually doesn’t appear you have code reformatted correctly. Instead of actually moving those syntax around, you’ll actually need to apply a filter to allow the date to be calculated in the future, but also to be formatted in a different method.

If you wanted to re-order the code to display a date that is 7 days since the email has been received while being in the format of DD-MM-YY, you’ll want to use the following:

{% today '%Y-%m-%d' as today %} {{ today|days_later:7|format_date_string|date:'n-j-y' }}

Have a great day!

David

Hi @David To , 

I have the same issue here but is there any way to display the date in the format DD/MM/YY instead of n-j-y  in oder to display the Os, it’s confusing for ou customer without it. When I try, i got an error. Thanks ! 


Reply