Filters transform a variable's value before it is rendered. You add them after the variable name with a pipe |. Multiple filters can be chained — they execute left to right.
{{ variable | filter_one | filter_two }}
| default
Returns an empty string if the value is missing, null, or undefined. A safe fallback to prevent variables from rendering as blank gaps in your copy.
{{ product.vendor | default }}
| fallback("text")
Returns the specified fallback text if the value is null or an empty string. Unlike | default which returns empty, this lets you supply a meaningful substitute.
{{ customer.first_name | fallback("there") }}
Used in a greeting: Hey {{ customer.first_name | fallback("there") }}! renders as "Hey Ashish!" for known customers and "Hey there!" for anonymous ones.
| max(n)
Ensures the value never exceeds n. If the value is greater than n, it returns n instead. Useful for capping percentages or quantities in display.
{{ product.discount_percent | max(50) }}
→ Displays the real discount percentage, but never more than 50
| min(n)
Ensures the value is never less than n. If the value is below n, it returns n. Useful for guaranteeing a minimum display value.
{{ cart.productCount | min(1) }}
→ Always shows at least 1 even if the count is 0
| currency
Formats a raw number into the store's currency format — adds the correct currency symbol, decimal places, and locale-specific formatting. Always use this after any filter that produces a number.
{{ product.price_wo_currency | apply_discount_fixed(100) | currency }}
→ Subtracts ₹100 from the price and formats the result as currency
| apply_discount_perc(percent, max?)
Applies a percentage discount to a number and returns the discounted value. The optional second argument caps the maximum discount amount — useful when you want to limit the saving even for high-priced products.
{{ product.price_wo_currency | apply_discount_perc(10) | currency }}
→ Shows the price with 10% off{{ product.price_wo_currency | apply_discount_perc(20, 500) | currency }}
→ Applies 20% off, but the discount is capped at ₹500
(so a ₹5,000 product shows ₹4,500, not ₹4,000)
| apply_discount_fixed(amount)
Subtracts a fixed amount from the value. The result is always at least 0 — it will never go negative.
{{ product.price_wo_currency | apply_discount_fixed(200) | currency }}
→ Subtracts ₹200 from the price{{ 100 | apply_discount_fixed(150) | currency }}
→ Returns ₹0 (result cannot go negative)
| split("delimiter", index)
Splits a string by the given delimiter and returns the element at the specified position. Supports negative indices to count from the end (-1 is the last element, -2 is second to last, etc.).
{{ product.tags | split(",", 0) }}
→ Returns the first tag from a comma-separated tag list{{ product.name | split(" ", -1) }}
→ Returns the last word of the product name{{ "www.example.com" | split(".", 1) }}
→ Returns "example"
| replace("search", "replacement")
Replaces all occurrences of the search string with the replacement string. Useful for cleaning up or reformatting values before display.
{{ product.name | replace("-", " ") }}
→ "summer-tee-blue" becomes "summer tee blue"{{ product.tags | replace(",", " · ") }}
→ Replaces commas with a styled separator for display
| manipulate_quantity(min, max)
Keeps a quantity value within the specified range. If the value is already within min–max, it is returned as-is. If it exceeds max, the remainder after dividing by max is returned (cycling back around). If the remainder is less than min, min is returned. Useful for looping or bounded progress indicators.
{{ variant.quantity | manipulate_quantity(1, 10) }}
→ If quantity is 7, returns 7
→ If quantity is 13, returns 3 (13 mod 10)
→ If quantity is 22, returns 2