Math Filters

Math filters can take multiple arguments, as with any other filters, are applied in order of left to right. Math filters can be applied to integers, as well as liquid objects and variables.

In this article:


Math filters can take multiple arguments, as with any other filters, are applied in order of left to right. Math filters can be applied to integers, as well as liquid objects and variables.

ceil

Rounds an output up to the nearest integer.

<p>{{ 1.2 | ceil }}</p> <p>{{ 1.6 | ceil }}</p>

divided_by

Divides an output by a number. The output is rounded to the nearest integer.

<p>{{ 50 | divided_by: 10 }}</p>

floor

Rounds an output down to the nearest integer.

<p>{{ 1.2 | ceil }}</p> <p>{{ 1.6 | ceil }}</p>

minus

Subtracts a number from an output.

<p>{{ 50 | minus: 15 }}</p>

plus

Adds a number to an output.

<p>{{ 50 | plus: 15 }}</p>

round

Rounds the output to the nearest integer or specified number of decimals.

<p>{{ 1.2 | round }}</p> <p>{{ 1.6 | round }}</p> <p>{{ 3.14159 | round 2 }}</p>

times

Multiplies an output by a number.

<p>{{ 50 | times: 2 }}</p>

modulo

Divides an output by a number and returns the remainder.

<p>{{ 11 | modulo:3 }}</p>

Contact support or access our 24/7 Live Chat:

Contact Support Live Chat

Need Help? Live Chat with Us.