Number Filters

Use number filters to convert, manipulate, and display numbers.

abs
Returns the absolute value of a number.
at_least number
Limits a number to a minimum value
at_most number
Limits a number to a maximum value
ceil: integer
Returns the next integer value greater than or equal to the current value.
divided_by: object operand
Divide the current value by operand.
floor: integer
Returns the next integer value less than or equal to the current value.
minus: object operand
Subtracts the operand from the current value.
modulo: object operand
Return the remainder of the current value when divided by the operand.
plus: object operand
Adds the operand to the current value. Note that this filter behaves differently if the current value is a string (eg: {{4 | plus:2}} = 6, but {{'Some' | plus:'Thing'}} = 'SomeThing').
rand
Returns a random integer between 0 and the current integer.
round: integer places  = 0
Rounds a decimal value to the specified number of places.
times: object operand
Multiply the current value by the operand. Note that this filter behaves differently if the current value is a string and the operand is an integer (eg: {{4 | times:2}} = 8, but {{'Bon' | times:2}} = 'BonBon').
to_int
Converts the input into an integer. Useful when grabbing query parameters or other string inputs.
to_number
Converts the input into a number, which could be an integer or a fractional number.

Developer Overview

Liquid Markup