To output values in your templates place them between two curly brackets:
The product name is {{ product.name }} The store name is {{ settings.store.name }}
Tags are a way of providing logic structure in templates:
{% if product.stock %} {% for image in product.image limit : 4 %}
Ticket Rewards also has some special tags to allow different types of actions. For example you can use the assign tag to create a new variable and give it a value:
{% assign thumbnail_size = 10 %} {% assign test = "hello" | uppercase %}
Another tag is use_layout that is used to specify a different layout than default.liquid for a template. For example to use a layout called narrow.liquid for a template use the tag as follows:
{% use_layout "narrow" %}
Use this tag to output different content for different conditions:
{% if a == "test" %} The a variable is equal to test {% endif %}
{% if product.stock %} The product is in stock {% else %} The product is not in stock {% endif %}
{% if product.price < 10 %} The product price is less than 10 {% endif %}
<ul> {% for item in cart.items %} <li>{{ item.name }}</li> {% endfor %} </ul>
Filters are a way of manipulating output. You start off with a value and chain as many filters as you want with the "|" (pipe) delimiter.
{{ "some text" | uppercase }} {{ "some text" | lowercase }} {{ product.body-html | trim_words : 60 }} {{ product.name | capitalize }} {{ product.price | money }} {{ "some text" | lowercase | trim_words : 20 }}
For a complete list of filters please see this page.
Blog • Privacy Policy • Terms & Conditions • Copyright 2024 Ticket Rewards