Liquid Tutorial

Filters Introduction

Source: Coding with Robby

What Are Liquid Filters?

Filters transform output values using the pipe | operator. They chain left to right — each filter receives the output of the previous one. Filters are the primary way to format money, resize images, escape HTML, and manipulate strings in Shopify themes.

Chained filters on one line
{{ product.title | upcase }}
{{ product.description | strip_html | truncate: 120 }}
{{ product.price | money_with_currency }}
  1. product.title | upcase — converts title to uppercase for display badges
  2. strip_html removes <p> tags from rich text descriptions
  3. truncate: 120 cuts text to 120 characters with …
  4. money_with_currency adds the ISO currency code (USD, EUR)

Filter arguments follow a colon: truncate: 120, image_url: width: 400. Multiple arguments use commas. Some filters (money, image_url) are Shopify-specific; others (upcase, split) come from core Liquid.

Try it Yourself
Tip: Read filters right-to-left mentally: the leftmost value enters the pipeline first.