Filters
Liquid filters are used to modify Liquid output.
Usage
To apply filters to an output, add the filter and any filter parameters within the output's curly brace delimiters {{ }}
, preceded by a pipe character |
. In the example below, product
is the object, title
is its property, and upcase
is the filter being applied.
{{ product.title | upcase }}
{
"product": {
"title": "Ace Cashmere Beanie"
}
}
ACE CASHMERE BEANIE
Filters with parameters
Many filters accept parameters that let you specify how the filter should be applied. Some filters might require parameters to be valid.
{{ product.title | remove: 'Ace' }}
{
"product": {
"title": "Ace Cashmere Beanie"
}
}
Cashmere Beanie
Using multiple filters
Multiple filters can be used on one output. They're applied from left to right.
{{ product.title | upcase | remove: 'ACE' }}
{
"product": {
"title": "Ace Cashmere Beanie"
}
}
CASHMERE BEANIE
Updated over 1 year ago