web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Unexpected Liquid 'or'...
Power Pages
Answered

Unexpected Liquid 'or' operator behavior

(0) ShareShare
ReportReport
Posted on by 12

Hi there,

 

I'm wondering if this is the intended behavior for liquid `or` operator, as this had made me spend hours to debug a thing that I was working on.

 

Basically, the behavior that I find confusing is: 

  • true or false evaluated into true, while
  • false or true evaluated into false

gwct_0-1678267400285.png

 

Categories:
I have the same question (0)
  • soundharya Profile Picture
    249 on at

    You have to use if condition 

    {% if product.type == "Shirt" or product.type == "Shoes" %}
     This is a shirt or a pair of shoes.
    {% endif %}
  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    {{...}} is not the same as {%.....%} .   In your case using the {{ it may just be outputting the first word it sees inside the {{ and not actually evaluating anything.

     

    <p>{% if true or false %}true {% else %}false {% endif %} </p>
    <p>{% if false or true %} true {% else %}false {% endif %} </p>
    <p>{% if true and true %} true {% else %} false {% endif %} </p>
    <p>{% if false and true %} true {% else %} false {% endif %} </p>
    <p>{% if false and false %} true {% else %}false {% endif %} </p>
    
    Outputs
    true
    true
    true
    false
    false

     

  • gwct Profile Picture
    12 on at

    Ah okay, now that I've checked again that  {{ }} and  {% %} do behave differently.
    And I think the behavior for {{ }} is similar to what can be found in {% assign varA = ... %} where the right side of the assignment just tries to grab the whatever on the leftmost side of the operation is it?

    I found the problem first time when i was trying to store the value of some boolean operation into a variable, where the operation results ends up around {% assign varA = false or false or true %} and it ends up storing false, that's why i was confused with the behavior

  • Verified answer
    Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    Yes, there can also be some fun stuff if it is multiple logical operators - its not really documented in the portal doco but there is a little bit more in the Shopify doco under Order of Operations https://shopify.github.io/liquid/basics/operators/ (Liquid originates from Shopify who open sourced it)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 61

#2
11manish Profile Picture

11manish 40

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 36 Most Valuable Professional

Last 30 days Overall leaderboard