Solved

Using feed variable within conditional block against profile property

  • 7 June 2021
  • 3 replies
  • 215 views

Badge +2

Apologies in advance if this has been answered anywhere but I’ve read through every piece of documentation I could find in regards to feeds and conditional blocks within Klaviyo and found no answer.

I’ve successfully integrated a feed into our email templates and we are also capturing a custom profile property for users joining the newsletter. I completely understand how conditional blocks work and I have success when passing a fixed value behind the operator but it doesn’t appear to work when trying to use a variable from within the feed. Here’s an example of what I’m trying to accomplish:

Custom profile property: State
Feed variable: {{ item.state }}
Condition: person|lookup:'State' = '{{ item.state }}'

 

This doesn’t appear to be supported. However if I use:

Condition: person|lookup:'State' = 'California'

It will work, but obviously only if it’s fixed content and not dynamic content from the feed. Is there any way to get this to work or some feasible workaround?

 

Thanks in advance for any help offered!

 

icon

Best answer by Dov 8 June 2021, 17:38

View original

3 replies

Userlevel 7
Badge +61

Hello @mjones,

Thank you for sharing your question with the Klaviyo Community.

Yes, the workaround for this would be to turn off the hide/show feature and use the following piece of code:

{% if person|lookup:'State' = item.state %}CONTENT HERE{% endif %}

Thanks and have a great day.

Badge +2

Thanks for the quick reply. However, that doesn’t appear to work either. It’s as if a variable cannot operate against another variable. It only works when evaluating a static value.

This doesn’t work:

{% if person|lookup:'State' = item.state %}CONTENT HERE{% endif %}

This works:

{% if person|lookup:'State' = 'Texas' %}CONTENT HERE{% endif %}

This doesn’t work:

{% if item.state = person|lookup:'State' %}CONTENT HERE{% endif %}

This works:

{% if item.state = 'Texas' %}CONTENT HERE{% endif %}

 

Badge +2

I was able to resolve the issue. Mistake on our end. Thanks for your assistance!

Reply