Math filters
Math filters perform math operations on numbers. You can use them on numbers, variables, or metafields that return a number.
Like other filters, you can use multiple math filters on one input. They apply from left to right. In the example below, minus is used first, then times, and finally divided_by.
abs
number | abs
Returns the absolute value of a number.
at_least
number | at_least
Limits a number to a minimum value.
at_most
number | at_most
Limits a number to a maximum value.
ceil
number | ceil
Rounds a number up to the nearest integer.
divided_by
number | divided_by: number
Divides a number by another number. The divided_by filter generates a result of the same type as the divisor. This means if you divide by an integer, the result will be an integer, and if you divide by a float, the result will be a float.
floor
number | floor
To round a number down to the nearest whole number.
minus
number | minus: number
Subtracts one number from another number.
modulo
number | modulo: number
Returns the leftover after dividing one number by another number.
plus
number | plus: number
Adds two numbers.
round
number | round
Rounds a number to the nearest integer.
Round to a specific number of decimal places
You can define how many decimal places to round to. If you don't specify a number, the round filter will round to the nearest whole number.
times
number | times: number
Multiplies a number by a given number.