Logic
From Shopify Wiki
(Difference between revisions)
(→Operators) |
(→Operators) |
||
| Line 17: | Line 17: | ||
===Operators=== | ===Operators=== | ||
You can use different operators when using logic statements... | You can use different operators when using logic statements... | ||
| - | * '' | + | * '''equ''' equal |
* '''<nowiki></nowiki>''' | * '''<nowiki></nowiki>''' | ||
* '''<nowiki></nowiki>''' | * '''<nowiki></nowiki>''' | ||
* '''<nowiki></nowiki>''' | * '''<nowiki></nowiki>''' | ||
* '''<nowiki></nowiki>''' | * '''<nowiki></nowiki>''' | ||
Revision as of 14:12, 23 April 2010
Logic are conditional Liquid statements.
Example of a logic statement
Lets say we are working on product.liquid template and want to display the message "Free shipping", but only on products whose price is greater than $100. Since the product will either have a price greater than $100 or less than $100, the if logic statement is the most appropriate statement to use...
{% if product.price > 100 %}
Free Shipping
{% else %}
No free shipping
{% end if %}
Notice how we use the {% %} logic tags and not the {{ }} output tags
Operators
You can use different operators when using logic statements...
- equ equal
