Forum Discussion

Nicky22's avatar
Nicky22
Active Member
9 months ago

If Statement in If Statement Liquid Code

Hey guys, hope you are well.

Please find below a liquid code which I cannot get on top of. I am trying to use an if statement into an if statement but cannot make it work. Any help please?

{% if api_trigger_properties.${XX_XX} == "XXX" %}{% if custom_attribute.${XX} == 'it_IT' or custom_attribute.${XX} == 'it_CH' %}ITALIAN COPY{% elsif custom_attribute.${XX} == 'es_ES' %}SPANISH COPY{% else %}ENGLISH COPY{% endif %}{% else %}{% if custom_attribute.${XX} == 'it_IT' or custom_attribute.${XX} == 'it_CH' %}TEXT IN ITALIAN{% elsif custom_attribute.${XX} == 'es_ES' %}TEXT IN SPANISH{% else %}TEXT IN ENGLISH{% endif %}{% endif %}

The error I am getting is:

  • Liquid syntax error: 'if' tag was never closed

Thanks in advance for your help

 

  • hey Nicky22 

    I don't see any issues with your code nor was I getting that same error although I precisely copy/pasted your code.

     

  • Sasha's avatar
    Sasha
    Practitioner III

    Nicky22  Are you looking to use the custom attribute in cases where the trigger property is missing?

  • DavidO's avatar
    DavidO
    Strategist II

    Same as AllanHeo I don't get any errors and the code executes correctly when I test it. Is there another IF tag earlier or later in your campaign that may not be closed? The old, one { will wreck your whole day.😂