Show/Hide Text Block in an email using Show/Hide Logic (new editor)

Badge +3

I want to include variable data (just a block of text) in a post-purchase flow.

eg, If a customer has purchase certain items, I want to show relevant data. Instructions, directions, extra info, etc. 


I found the Show/Hide logic feature, but it’s just a text-input line. 

I would’ve expected a drop-down showing all of the available variables/syntax and options. I’m really surprised that it’s this open-ended.


Is there a list somewhere of possible variables that I can copy/paste in to ensure that the logic string is entered correctly? 


All of the instructions I can find for this are the older editor, too - and none are for this specific use case. 



Best answer by matt.steinruck 2 March 2022, 23:12

View original

11 replies

Badge +3

Found this!


I see that when you do a Preview of the email itself, all of the personalization variables show up. 


So, if I want this block to only show up for people who have purchased this product, I can paste in 

{{ event.ProductID }} == 7141931974827

in the logic box. 


That is helpful. 

Badge +3

So, actually - Syntax questions:

  • Are there spaces around the == ?
  • Are there quotes around the product ID?
  • Does a comma seperator work for multiple IDs? 
  • Space after the comma?

{{ event.ProductID }} == 6093805486251, 6550791749803   


Is that correct?

Badge +3

Apparently that’s not it - I keep getting this error. 

I’ve tried it a bunch of ways. 

Help, still?


Badge +3

Correct syntax is:


event|lookup:'ProductID' = 6093805486251 or event|lookup:'ProductID' = 6550791749803

Userlevel 7
Badge +60

Hello @matt.steinruck,

Glad to hear you were able to come up with the correct show/hide condition yourself! 

I mention this a lot, but I’m a huge fan of @retention’s How To Set Show/Hide Blocks Based On A Custom Profile Property blog and guidance he offered in the Community post below: 

You’re absolutely correct that through previewing the email, you can reference a list of all the variables that were synced from the event you want to referencing. This is also mentioned in the Show/Hide Conditions and Event Data section of the How to Show or Hide Template Blocks Based on Dynamic Variables Help Center article. 

Thanks for being a part of the Klaviyo Community! I’m sure other members who may be having the same questions will find your comments and solution helpful!


Badge +3

Thanks David - very helpful - I will read up on that, too. 


(In fairness, I had some help to come up with the right syntax here - it was a bit of a trial and error with support as well, but we got it, and Im excited that it’s working!)

Badge +2

Hello! Would you know what’s the syntax if the lookup condition is text?

event|lookup:’event.Items.0’ == “Weighted_Blanket”

What’s wrong with my syntax? 

Userlevel 7
Badge +60

Hey @Keslie,

If you were trying to use a show/hide function to evaluate if the event|lookup:’event.Items.0’ variable equaled “Weighted_Blanket”, I believe you’ll want to use the ’PROPERTY’ in event.variable format since the event|lookup:’event.Items.0’ variable seems to be in a list/array data type. 

As mentioned in both the How to show or hide template blocks based on dynamic variables classic editor and new editor Help Center articles: How your data is stored will influence which show/hide conditions will work for you. Learn how to identify data types in your own account. 

Comparison operators would only be used for returning true or false statements which are typically for data points stored as text, number, date, or boolean data types - not lists/arrays.


Badge +2

Hello @David To,

Super appreciate your response. I apologize as my coding skills are limited. I tried the following and it says my variables/ syntax is incorrect.

“WEIGHTED_BLANKET” in 'event.Items'
“WEIGHTED_BLANKET” in event|lookup:'event.Items'

I’m using the new editor.

Thanks so much!

Userlevel 7
Badge +60

Hey @Keslie,

That error message you’re seeing is usually very helpful as it is calling out either the format of your condition is incorrect and/or your syntax and variables are incorrect.

Did you happen to create the condition somewhere else and then proceeded to copy and paste the condition in the show hide/display menu of the template? If you are, it’s typically best practice to either type out the condition manually or copying and pasting the condition without formatting. I’ve seen this occur a number of times where you’ll actually be accidentally pasting in some additional formatting without realizing as I’ve explained prior in the below Community post which would include variables and syntaxes that are not recognized through the template editor:

Some other great resource I would highly suggest using are @retention’s How To Set Show/Hide Blocks Based On A Custom Profile Property blog article, our Conditional logic reference, and my colleague @Anna McCarthy’s Using show/hide blocks Community post which features a really helpful tutorial video!

If you’re still having troubles, you may want to reach out and speak to your own email designer or even reaching out to our Support colleagues to see if they can spot anything that you may have missed through your template. 


Badge +2

It finally worked! Thank you so much, @David To! The articles you suggested really helped a lot.