Solved

Logic based HTML email

  • 21 August 2023
  • 4 replies
  • 308 views

Badge +1

Is there is a way to add Conditional or Logic on Custom HTML emailers ? or maybe to do both HTML and drag and drop ?

I am facing an issue as I have pre-defined HTML email template but i don't want to show certain products to certain to some people is there is way I can add logic in HTML code itself?

icon

Best answer by Taylor Tarpley 21 August 2023, 18:29

View original

4 replies

Userlevel 7
Badge +60

Hi there @Sumit_2809

 

Welcome to the Community! 

 

Yes, you can definitely do this within an HTML template. The show/hide logic is just a user-friendly rendering of conditional If-Else statements in Django.


 
You can use this same logic to insert into your HTML template based on the content you would like to show or hide. To conditionally show content in your email, wrap this portion of the email an initial {% if insert_your_condition %} as well as the closing {% endif %} tag. You can reference the same profile/event variables you would use in the Display Options within Klaviyo's drag-and-drop editor.


 
I’d recommend checking out these helpful resources on conditional statements below to gain more insight!
Klaviyo Developers Portal - Use conditionals in messages
How to show or hide template blocks and sections based on dynamic variables
Template tags and variable syntax reference
 
It should be noted that since you’re using a custom HTML template, Klaviyo can’t assist with designing or building out this templates, however, I’d reach out to your developer or a Klaviyo partner to help build this out for you if you need assistance. 

 

Hope his helps!

-Taylor 

Userlevel 7
Badge +58

Just to add to @Taylor Tarpley answer here, you can also use the Show/Hide feature for the Block or Section in the Drag and Drop version.  You can learn more about it here:

 

Joseph Hsieh // retentioncommerce.com // twitter: @retenion 

Badge +1

Is there is a way to add Conditional or Logic on Custom HTML emailers ? or maybe to do both HTML and drag and drop ?

I am facing an issue as I have pre-defined HTML email template but i don't want to show certain products to certain to some people is there is way I can add logic in HTML code itself?

Thank you so much for your help Taylor...Sure I will reach out to you if  required!😀

Badge +1

Thank you Guys!

Reply