Skip to Content
ReferenceLiquid Filters

Liquid Filter Reference

Filters transform the output of a variable or expression in a Liquid template. They are applied with the pipe (|) character and can be chained — each filter receives the output of the previous one.

{{ variable | filter }} {{ variable | filter1 | filter2 }} {{ variable | filter: argument }}

AppFunnel uses the LiquidJS  engine with all standard built-in filters, plus a set of custom filters. This page documents the most commonly used filters for funnel building.


Arithmetic Filters

Perform math operations on numeric values. These are built-in LiquidJS filters.

FilterDescriptionExampleOutput
plusAdd a number.{{ 5 | plus: 3 }}8
minusSubtract a number.{{ 10 | minus: 3 }}7
timesMultiply by a number.{{ 4 | times: 3 }}12
divided_byDivide by a number.{{ 10 | divided_by: 3 }}3
moduloRemainder after division.{{ 10 | modulo: 3 }}1

divided_by performs integer division when both operands are integers. To get a decimal result, ensure one operand is a float: {{ 10.0 | divided_by: 3 }} outputs 3.3333.... Chain with round or to_fixed to control decimal places.

Chaining Arithmetic

Filters are applied left to right. Each filter receives the output of the previous one:

{{ products.yearly.rawPrice | divided_by: 12 | round }}

This divides the yearly raw price by 12 (to get monthly equivalent), then rounds to the nearest integer.

{{ products.monthly.rawPrice | times: 12 | minus: products.yearly.rawPrice | to_fixed: 2 }}

This calculates the yearly savings of choosing an annual plan over monthly billing.


Number Formatting Filters

Format numeric values for display.

FilterDescriptionExampleOutput
roundRound to the nearest integer.{{ 4.6 | round }}5
floorRound down to the nearest integer.{{ 4.9 | floor }}4
ceilRound up to the nearest integer.{{ 4.1 | ceil }}5
absAbsolute value.{{ -7 | abs }}7
to_fixedFormat to a fixed number of decimal places.{{ 9.9 | to_fixed: 2 }}9.90

to_fixed is a custom AppFunnel filter (not part of standard Liquid). It is particularly useful for displaying prices: {{ products.selected.rawPrice | to_fixed: 2 }} ensures two decimal places.

Examples

Format a computed daily price:

${{ products.yearly.rawPrice | divided_by: 365 | to_fixed: 2 }}/day

Output: $0.16/day

Display a countdown timer (minutes:seconds):

{{ 600 | minus: page.timeOnCurrent | divided_by: 60 | floor }}:{{ 600 | minus: page.timeOnCurrent | modulo: 60 | round }}

Output: 8:34 (when 86 seconds have passed on the page)


String Filters

Transform string values.

FilterDescriptionExampleOutput
upcaseConvert to uppercase.{{ "hello" | upcase }}HELLO
downcaseConvert to lowercase.{{ "HELLO" | downcase }}hello
capitalizeCapitalize the first character.{{ "hello world" | capitalize }}Hello world
stripRemove leading/trailing whitespace.{{ " hello " | strip }}hello
truncateTruncate to a max length with ellipsis.{{ "Hello world" | truncate: 8 }}Hello...
replaceReplace occurrences of a string.{{ "Hello world" | replace: "world", "there" }}Hello there
appendAppend a string.{{ "Hello" | append: " world" }}Hello world
prependPrepend a string.{{ "world" | prepend: "Hello " }}Hello world
splitSplit a string into an array.{{ "a,b,c" | split: "," | size }}3

Examples

Display a user’s name in uppercase:

{{ user.name | upcase }}

Capitalize a quiz answer:

Your goal: {{ answers.goal | capitalize }}

Utility Filters

FilterDescriptionExampleOutput
defaultProvide a fallback if the value is empty, nil, or false.{{ user.name | default: "friend" }}friend (if name is empty)
sizeReturn the length of a string or array.{{ answers.interests | size }}3 (if array has 3 items)

Examples

Greeting with a fallback:

Hello, {{ user.name | default: "there" }}!

Output when name is empty: Hello, there!

Show count of selected interests:

You selected {{ answers.interests | size }} interests.

For conditionals (if/elsif/else), variable assignment (assign), and full template syntax, see Liquid Templates.

See the full LiquidJS documentation  for additional standard filters not listed here.

Last updated on