Solved

Show/Hide Blocks are not working with a combination of 'OR' and 'AND'

  • 27 June 2023
  • 1 reply
  • 58 views

Badge +2

Hello, I’m currently building a logic that displays blocks like this.
event.extra.line_items.0.product.variant.sku == Product A or  event.extra.line_items.0.product.variant.sku == Product B and event.extra.line_items.0.product.variant.sku == Product C

This syntax works but not how it’s supposed to. The logic I want is (A+B) * C but what’s happening is A + B*C. I want Either A or B to be paired with C not only B. I’ve tried several characters to group {}, () but none of them worked. Can anyone confirm if what I’m trying to do is possible in Klaviyo Show/Hide block logic? Thanks!

icon

Best answer by Brian Turcotte 27 June 2023, 14:17

View original

1 reply

Userlevel 7
Badge +36

Hi @joshuafris!

At this time, Klaviyo does not support nested logic using the show/hide field within the template editor.  You would need to use nested IF logic using the <source> button, but that might not apply to this use case.

The code would look something like this:

{% if CONDITION_C %}
{ % if CONDITION_A %}
this would show if CONDITION_A AND CONDITION_C are TRUE
{% elif CONDITION_B %}
this would show if CONDITION_B AND CONDITION_C are TRUE
{% else %}
this would show if only CONDITION_C is TRUE
{% endif %}

 

You can learn more about this in the If-Else Blocks section of our Guide to Template Tags and Variable Syntax help center article and furthermore you'll find additional details here.

 

I hope this helps to clarify!

- Brian

Reply