Skip to main content
Solved

Show/Hide Blocks with IF/ELSE condition for images


Forum|alt.badge.img+3

Hi!

I’ve been reading about the Show/Hide function but I still can’t figure it out to apply it to my use case.

 

I want to show image 1 to US customers and image 2 to UK customers and image 3 to the rest of the users. How can I use the Show/Hide function + the IF/ELSE condition to make this work? or is there any other option for this?

 

Right now I applied the logic: person.Country == "US" to image 1 and person.Country == "UK" to image 2, but I’m still seeing image 3 (for the rest) when I preview the email for each country.

 

Thank you for your help!

Best answer by VH.Email

@AlmaMedinaaa - perhaps double check in your client profiles what the exact format of the area you are trying to pull is. 100% they will hide, I had this exact logic sent out to my list this morning and it the appropriate blocks were hidden.

I also noticed in your original post you have “ instead of just ‘ just trying just the ‘ vs the double. That worked for me where as the “ didn’t. No clue why. But give it a go!

 

For example this was my logic (this email went out this morning and worked perfectly). I copy and pasted the below directly from the platform so you know exactly how I did it. I also included a screenshot of what the ‘not’ logic looks like in the show/hide logic section. 

 

Block 1: Wanted to show to only Women preference

person.Preference == 'women'

 

Block 2: Wanted to show to only Men preference

person.Preference == 'men'

 

Block 3: Wanted to show to Both preference

 

person.Preference == 'both'

 

Block 4: Wanted to show where no preference was selected

not person.Preference == 'men' and not person.Preference == 'women' and not person.Preference == 'both'

 

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

6 replies

Jessica eCommerce Badassery
Partner
Forum|alt.badge.img+19

@AlmaMedinaaa 

 

On the image for the rest you have to put the condition:

not person.Country == "US" and not person.Country == "UK"

 

see more details here: 

https://help.klaviyo.com/hc/en-us/articles/7655926841499


Forum|alt.badge.img+3
  • Author
  • Contributor II
  • 3 replies
  • July 11, 2023

Hi @Jessica eCommerce Badassery 

 

I’m still getting both versions when I preview with the US customer. I also tried “!-” but it didn’t work


Forum|alt.badge.img
  • Contributor I
  • 2 replies
  • July 12, 2023

I just had the same issue and after like 2 hours figured it out. It’s very dependant on whether your property is capitalized or not. Try capitalizing or making the areas lower case (whichever you haven’t already tried) to see if that helps! It worked for me. 


Forum|alt.badge.img+3
  • Author
  • Contributor II
  • 3 replies
  • July 12, 2023

@VH.Email I did that, but it’s still not working, it’s weird because it works on the side of “show” but not the “hide”. I mean, these blocks are supposed to do that too, right?


Forum|alt.badge.img
  • Contributor I
  • 2 replies
  • Answer
  • July 12, 2023

@AlmaMedinaaa - perhaps double check in your client profiles what the exact format of the area you are trying to pull is. 100% they will hide, I had this exact logic sent out to my list this morning and it the appropriate blocks were hidden.

I also noticed in your original post you have “ instead of just ‘ just trying just the ‘ vs the double. That worked for me where as the “ didn’t. No clue why. But give it a go!

 

For example this was my logic (this email went out this morning and worked perfectly). I copy and pasted the below directly from the platform so you know exactly how I did it. I also included a screenshot of what the ‘not’ logic looks like in the show/hide logic section. 

 

Block 1: Wanted to show to only Women preference

person.Preference == 'women'

 

Block 2: Wanted to show to only Men preference

person.Preference == 'men'

 

Block 3: Wanted to show to Both preference

 

person.Preference == 'both'

 

Block 4: Wanted to show where no preference was selected

not person.Preference == 'men' and not person.Preference == 'women' and not person.Preference == 'both'

 

 


Forum|alt.badge.img+3
  • Author
  • Contributor II
  • 3 replies
  • July 24, 2023

Thank you @VH.Email! This worked for me! 💃