Security Blanket
Regular price
$9.99
Sale
Play and stick these colorful letters! As you will see the syntax for Liquid logic is slightly different to output. Instead of the {{ }}
delimiters we use {% %}
.
In the above example we are controlling what is output to our template using a simple if
, else
, endif
statement. In many ways if
statements are like questions.
In the above example if the answer to our if
statement question is true
we render the words "This product is available", if it's false
our template carries on and outputs the text following our {% else %}
clause - in this case "Sorry, this product it sold out"
.
You will find yourself using if
statements a lot in Shopify theme dev elopment. Here's another example to help your understanding: