• Home
  • Solutions

Template filters

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.


Filters index

home_url
Generates an url relative to your store path
{{ '/' | home_url }} /mystore
{{ '/contact' | home_url }} /mystore/contact
resource_url
Gives the url for one of your resources
{{ 'script.js' | resource_url }}
global_url
Gives the url for global resources like javascript libraries stored by Ticket Rewards
{{ 'less.js' | global_url }}
capitalize
Capitalizes the text
{{ 'capitalize me' | capitalize }} Capitalize Me
uppercase
Converts a text to caps
{{ 'uppercase me' | uppercase }} UPPERCASE ME
lowercase
Converts a text to lower case
{{ 'LOWERCASE ME' | lowercase }} lowercase me
to_url New
Converts a regular text to one that can be used as an url (also know as handelize)
{{ 'This would be my 10!' | to_url }} this-would-be-my-10
plural
Specify the pluralized version of a word
{{ 1 | plural: 'item', 'items' }} item
{{ 3 | plural: 'item', 'items' }} items
{{ cart.item_count | plural: 'item', 'items' }} item if the cart has one item and items if the cart has more than one item
money
Converts a number into a price value. The currency is automatically added from the shop settings
{{ 1 | money }} 1.00 EUR
{{ 2 | money: 3 }} 2.000 EUR
script_tag
Generates a script tag
{{ 'script.js' | script_tag }} <script src="script.js" type="text/javascript"></script>
{{ 'script.js' | resource_url | script_tag }} <script src="URL_TO_YOUR_script.js_RESOURCE" type="text/javascript"></script>
stylesheet_tag
Generates a stylesheet tag
{{ 'style.css' | stylesheet_tag }} <link rel="stylesheet" type="text/css" href="style.css" />
{{ 'style.css' | resource_url | stylesheet_tag }} <link rel="stylesheet" type="text/css" href="URL_TO_YOUR_style.css_RESOURCE" />
product_url
Generates a link to one of your products
{{ product | product_url }} /mystore/product/PRODUCT_HANDLE_OR_ID
{{ product.id | product_url }} /mystore/product/PRODUCT_ID
{{ product.handle | product_url }} /mystore/product/PRODUCT_HANDLE
collection_url
Generates a link to one of your collections
{{ collection | collection_url }} /mystore/collection/COLLECTION_HANDLE
use_layout
Tells the layout composer to use a different layout than default one
{{ use_layout alternate }} Uses alternate.liquid layout instead of default.liquid
include
Includes a template or snippet in the specified location
{% include '/snippets/search.liquid' %} Will include the snippet search.liquid
{% include '/snippets/categories.liquid' param:collection %} Will include the template categories.liquid in which the variable param will be passed the value of collection
  • Using Ticket Rewards

    • Getting started
    • Blog
  • I'm a designer

    • Getting started
    • Templates
    • Variables
    • Filters
  • I'm a developer

    • Javascript API

Documentation search

Blog • Privacy Policy • Terms & Conditions • Copyright 2024 Ticket Rewards