LiquidFilters

Filters

A filter changes a value on its way out: {{ product.price | money }}. Joomni has every standard Liquid filter, plus the Shopify filters a theme needs for money, images, dates and colours. Using a filter that does not exist stops the section from saving.

Try a filter

Pick an example or type your own. The output is the exact text the filter produces, run against a sample product page.

Filter testerSample store data
NPR 2,499.00

Store filters

FilterExampleWhat it does
money{{ product.price | money }}The amount in the store’s currency and locale.
money_with_currency{{ product.price | money_with_currency }}The same, with the currency code after it.
money_without_currency{{ product.price | money_without_currency }}Just the number, two decimals.
image_url{{ product.featured_image | image_url: 600 }}A resized image URL. Takes a URL or an image object, and a width (also width: 600).
image_tag{{ product.featured_image | image_url: 800 | image_tag: alt: product.title }}A complete responsive <img> with srcset. Options: width, height, alt, class, loading (default lazy), sizes, widths, fetchpriority.
placeholder_svg_tag{{ 'image' | placeholder_svg_tag: 'ph' }}A neutral placeholder graphic, for an empty image setting.
link_to{{ 'Shop all' | link_to: '/collections' }}An <a> with that text and href.
url_for_vendor{{ product.vendor | url_for_vendor }}The listing URL for a brand.
url_for_type{{ product.type | url_for_type }}The listing URL for a product type.
json{{ product.tags | json }}JSON, safe to put inside a <script type="application/json">.
time_tag{{ article.published_at | time_tag: format: 'abbreviated_date' }}A <time> element. Formats: date, date_at_time, abbreviated_date, month_day_year.
handleize · handle{{ 'Summer Sale!' | handleize }}A URL slug.
t{{ 'cart.items' | t: count: 2 }}A translation. Missing keys render the key.
logo_size_css{{ s.logo_custom_width | logo_size_css: s.logo_custom_height, s.logo_height }}CSS declarations for a header logo size, from a width and height in px or %.

Images

image_url takes an image URL (or an object with one) and a width, and returns a resized URL from the Joomni image service. Always ask for roughly the size you display: a 4,000 px photo in a 300 px card is the most common reason a section is slow. image_tag goes one step further and writes the whole <img> with a srcset, lazy loading and the alt text you give it.

Image filtersSample store data
https://picsum.photos/seed/joomni-1/800/1000?w=400

Money

Prices are plain numbers in the store's currency. money formats them for the store's currency and locale, so never write the currency symbol yourself. Do arithmetic first, then format: {{ product.compare_at_price | minus: product.price | money }}.

Colour filters

Colour filters take any CSS colour (hex, rgb or hsl) and return a new one. They are how a section builds a tint, a hover shade or a readable text colour from the merchant's single brand colour. A value that is not a colour, like an empty setting, passes through unchanged.

FilterExampleWhat it does
color_to_rgb{{ '#ff6b6b' | color_to_rgb }}rgb() or rgba().
color_to_hex{{ 'rgb(255, 107, 107)' | color_to_hex }}A hex.
color_to_hsl{{ '#ff6b6b' | color_to_hsl }}hsl() or hsla().
color_lighten · color_darken{{ settings.color_primary | color_lighten: 20 }}Changes lightness by that many points.
color_saturate · color_desaturate{{ settings.color_accent | color_desaturate: 30 }}Changes saturation by that many points.
color_mix{{ settings.color_accent | color_mix: '#ffffff', 30 }}Mixes two colours. The weight (0–100) is the first colour’s share.
color_modify{{ settings.color_primary | color_modify: 'alpha', 0.15 }}Sets one channel: alpha, red, green, blue, hue, saturation or lightness.
color_brightness{{ settings.color_background | color_brightness }}Perceived brightness, 0–255. Under ~128 is dark.
color_contrast{{ settings.color_text | color_contrast: settings.color_background }}WCAG contrast ratio, like 4.5.
Tints from the theme colour
Playground
Loading editor…

Runs in your browser on sample data: the same engine and filters as the storefront. Widgets such as add to cart are simulated: clicking one shows what would happen on a store.

Switch the theme

Change the playground's theme above: the swatches follow the merchant's primary colour, and the text flips between black and white by brightness. Building colours from tokens is what lets one theme look right on every store.

Standard filters

Everything in standard Liquid works:

GroupFilters
Textappend · prepend · capitalize · downcase · upcase · strip · lstrip · rstrip · strip_html · strip_newlines · newline_to_br · replace · replace_first · replace_last · remove · remove_first · remove_last · split · slice · truncate · truncatewords · escape · escape_once · url_encode · url_decode · default
Numbersplus · minus · times · divided_by · modulo · round · ceil · floor · abs · at_least · at_most
Arrayssize · first · last · join · map · where · where_exp · reject · find · sort · sort_natural · reverse · uniq · compact · concat · push · sum · group_by
Datesdate (strftime: "%b %d, %Y") · date_to_xmlschema · date_to_string
Standard filtersSample store data
Merino Crew Knit, Leather Weekender, Cashmere Scarf

Translations

{{ 'cart.title' | t }} looks a key up in the store's translations. Named values fill placeholders, and count picks the plural form: {{ 'cart.items' | t: count: 2 }} reads cart.items.one or cart.items.other and replaces {{ count }} in it. A key with no translation prints the key itself, which is easy to spot when testing.

Still stuck? Our team reads every message.

Need help?