Outputs the absolute value of a number.
Input
assuming something.value is -3
{{ something.value | abs }}
Output
3
Limits a number to a minimum value.
Input
assuming something.value is 4
{{ something.value | atLeast: 5 }}
Output
5
Input
assuming something.value is 4
{{ something.value | atLeast: 3 }}
Output
4
Limits a number to a maximum value.
Input
assuming something.value is 6
{{ something.value | atMost: 5 }}
Output
5
Input
assuming something.value is 4
{{ something.value | atMost: 5 }}
Output
4
Rounds a number up to the nearest integer.
Input
assuming something.value is 1.2
{{ something.value | ceil }}
Output
2
Divides a number by a given number.
Input
assuming something.value is 24
{{ something.value | dividedBy: 5 }}
Output
4.8
Rounds a number down to the nearest integer.
Input
assuming something.value is 1.2
{{ something.value | floor }}
Output
1
Subtracts a given number from another number.
Input
assuming something.value is 4
{{ something.value | minus: 2 }}
Output
2
Returns the remainder of dividing a number by a given number.
Input
assuming something.value is 12
{{ something.value | modulo: 5 }}
Output
2
Outputs the singular or plural version of a string based on a given number.
Input
assuming something.value is 1
{{ something.value | pluralize: 'item', 'items' }}
Output
item
Input
assuming something.value is 5
{{ something.value | pluralize: 'item', 'items' }}
Output
items
Adds two numbers.
Input
assuming something.value is 2
{{ something.value | plus: 2 }}
Output
4
Rounds a number to the nearest integer or, if a number is passed as an argument, to that number of decimal places.
Input
assuming something.value is 2.7
{{ something.value | round }}
Output
3
Input
assuming something.value is 3.14159
{{ something.value | round: 2 }}
Output
3.14
Multiplies a number by a given number.
Input
assuming something.value is 2
{{ something.value | times: 2 }}
Output
4
Adds a given string to the end of a string.
Input
assuming product.title is "Health potion"
{{ product.title | append: ' with extra magic.' }}
Output
Health potion with extra magic.
Converts a string to CamelCase.
Input
assuming product.title is "Health potion"
{{ product.title | camelize }}
Output
HealthPotion
Capitalizes the first word in a string.
Input
assuming product.title is "health potion"
{{ product.title | capitalize }}
Output
Health potion
Converts a string to all lowercase characters
Input
assuming product.title is "Health Potion"
{{ product.title | downcase }}
Output
health potion
Escapes special characters in HTML, such as <>, ', and &, and converts characters into escape sequences.
Input
assuming product.description is "Health " Potion"
{{ product.title | escape }}
Output
Health " Potion
Strips all whitespace from the left of a string.
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | lstrip }}
Output
"Some potions create whitespace. "
Adds a given string to the beginning of a string.
Input
assuming product.title is "Health Potion"
{{ product.title | prepend: 'Super ' }}
Output
Super Health Potion
Removes any instance of a substring inside a string. Use single quotes around a longer string of text. i.e. | remove : 'long string'.
Input
assuming product.title is "Health potion"
{{ product.title | remove: 'o' }}
Output
Super Health Ptin
Removes the first instance of a substring inside a string.
Input
assuming product.title is "Health potion"
{{ product.title | removeFirst: 'o' }}
Output
Super Health Ption
Removes the last instance of a substring inside a string.
Input
assuming product.title is "Health potion"
{{ product.title | removeLast: 'o' }}
Output
Super Health Potin
Replaces any instance of a substring inside a string with a given string.
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replace: '-', '_' }}
Output
new_health_potion
Replaces the first instance of a substring inside a string with a given string.
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replaceFirst: '-', '_' }}
Output
new_health-potion
Replaces the last instance of a substring inside a string with a given string.
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replaceLast: '-', '_' }}
Output
new-health_potion
Strips all whitespace from the right of a string.
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | rstrip }}
Output
" Some potions create whitespace."
Returns a substring, starting at a given 0-based index.
Input
assuming product.handle is "new-health-potion"
{{ product.handle | slice: 0,3 }}
Output
new
Strips all whitespace from the left and right of a string.
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | strip }}
Output
"Some potions create whitespace."
Truncates a string down to a given number of characters.
Input
assuming product.title is "Health Potion"
{{ product.title | truncate: 9 }}
Output
Health...
Converts a string to all uppercase characters
Input
assuming product.title is "Health Potion"
{{ product.title | upcase }}
Output
HEALTH POTION