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.
| Filter | Description | Example | Output |
|---|---|---|---|
plus | Add a number. | {{ 5 | plus: 3 }} | 8 |
minus | Subtract a number. | {{ 10 | minus: 3 }} | 7 |
times | Multiply by a number. | {{ 4 | times: 3 }} | 12 |
divided_by | Divide by a number. | {{ 10 | divided_by: 3 }} | 3 |
modulo | Remainder 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.
| Filter | Description | Example | Output |
|---|---|---|---|
round | Round to the nearest integer. | {{ 4.6 | round }} | 5 |
floor | Round down to the nearest integer. | {{ 4.9 | floor }} | 4 |
ceil | Round up to the nearest integer. | {{ 4.1 | ceil }} | 5 |
abs | Absolute value. | {{ -7 | abs }} | 7 |
to_fixed | Format 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 }}/dayOutput: $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.
| Filter | Description | Example | Output |
|---|---|---|---|
upcase | Convert to uppercase. | {{ "hello" | upcase }} | HELLO |
downcase | Convert to lowercase. | {{ "HELLO" | downcase }} | hello |
capitalize | Capitalize the first character. | {{ "hello world" | capitalize }} | Hello world |
strip | Remove leading/trailing whitespace. | {{ " hello " | strip }} | hello |
truncate | Truncate to a max length with ellipsis. | {{ "Hello world" | truncate: 8 }} | Hello... |
replace | Replace occurrences of a string. | {{ "Hello world" | replace: "world", "there" }} | Hello there |
append | Append a string. | {{ "Hello" | append: " world" }} | Hello world |
prepend | Prepend a string. | {{ "world" | prepend: "Hello " }} | Hello world |
split | Split 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
| Filter | Description | Example | Output |
|---|---|---|---|
default | Provide a fallback if the value is empty, nil, or false. | {{ user.name | default: "friend" }} | friend (if name is empty) |
size | Return 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.