> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Filters

> Transform and format output with Aqua filters

# Aqua Filters

Filters modify the output of objects and variables. Chain multiple filters with the pipe `|` character.

```aqua theme={null}
{{ product.title | upcase | truncate: 20 }}
```

## Money Filters

Format prices according to store currency settings.

<Note>
  **Important**: Prices in LaunchMyStore are stored as decimals (e.g., `19.99`), not cents. No division by 100 needed.
</Note>

### money

Formats a number as currency using the store's `money_format`.

```aqua theme={null}
{{ product.price | money }}
```

| Input     | Output      |
| --------- | ----------- |
| `19.99`   | `$19.99`    |
| `1234.50` | `$1,234.50` |

### money\_with\_currency

Includes the currency code.

```aqua theme={null}
{{ product.price | money_with_currency }}
```

| Input   | Output       |
| ------- | ------------ |
| `19.99` | `$19.99 USD` |

### money\_without\_currency

Formats without the currency symbol.

```aqua theme={null}
{{ product.price | money_without_currency }}
```

| Input   | Output  |
| ------- | ------- |
| `19.99` | `19.99` |

### money\_without\_trailing\_zeros

Removes `.00` from whole numbers.

```aqua theme={null}
{{ 20.00 | money_without_trailing_zeros }}
{{ 19.99 | money_without_trailing_zeros }}
```

| Input   | Output   |
| ------- | -------- |
| `20.00` | `$20`    |
| `19.99` | `$19.99` |

***

## Asset Filters

Generate URLs for theme assets.

### asset\_url

Returns the URL for an asset in the theme's `assets/` folder.

```aqua theme={null}
{{ 'styles.css' | asset_url }}
{{ 'logo.png' | asset_url }}
```

Output: `https://cdn.launchmystore.io/themes/{id}/assets/styles.css`

### asset\_img\_url

Returns sized image URL for an asset.

```aqua theme={null}
{{ 'logo.png' | asset_img_url: '200x' }}
{{ 'banner.jpg' | asset_img_url: 'master' }}
```

### file\_url

Returns URL for files uploaded to the theme.

```aqua theme={null}
{{ 'document.pdf' | file_url }}
```

### stylesheet\_tag

Generates a `<link>` tag for CSS.

```aqua theme={null}
{{ 'styles.css' | asset_url | stylesheet_tag }}
```

Output:

```html theme={null}
<link rel="stylesheet" href="https://cdn.../styles.css">
```

### script\_tag

Generates a `<script>` tag.

```aqua theme={null}
{{ 'app.js' | asset_url | script_tag }}
```

Output:

```html theme={null}
<script src="https://cdn.../app.js"></script>
```

### preload\_tag

Generates a preload link.

```aqua theme={null}
{{ 'critical.css' | asset_url | preload_tag: as: 'style' }}
```

***

## Image Filters

Work with product, collection, and other images.

### img\_url / image\_url

Returns a resized image URL.

```aqua theme={null}
{{ product.featured_image | img_url: '400x400' }}
{{ product.featured_image | img_url: '200x' }}
{{ product.featured_image | img_url: 'x300' }}
{{ product.featured_image | img_url: 'master' }}
```

**Size formats:**

* `400x400` - Exact dimensions
* `400x` - Width only, proportional height
* `x400` - Height only, proportional width
* `master` - Original size
* `small`, `medium`, `large` - Preset sizes

### img\_tag / image\_tag

Generates an `<img>` tag with optional attributes.

```aqua theme={null}
{{ product.featured_image | img_tag }}
{{ product.featured_image | img_tag: alt: product.title, class: 'product-image' }}
```

Output:

```html theme={null}
<img src="..." alt="Product Title" class="product-image">
```

### media\_tag

Renders appropriate tag for any media type (image, video, 3D model).

```aqua theme={null}
{{ product.media[0] | media_tag }}
```

***

## String Filters

### upcase

```aqua theme={null}
{{ 'hello' | upcase }}
```

Output: `HELLO`

### downcase

```aqua theme={null}
{{ 'HELLO' | downcase }}
```

Output: `hello`

### capitalize

Capitalizes the first character.

```aqua theme={null}
{{ 'hello world' | capitalize }}
```

Output: `Hello world`

### truncate

Truncates to a character limit with ellipsis.

```aqua theme={null}
{{ 'This is a long description' | truncate: 15 }}
{{ 'This is a long description' | truncate: 15, '...' }}
```

Output: `This is a lo...`

### truncatewords

Truncates to a word limit.

```aqua theme={null}
{{ 'This is a very long description' | truncatewords: 3 }}
```

Output: `This is a...`

### strip\_html

Removes all HTML tags.

```aqua theme={null}
{{ '<p>Hello <strong>world</strong></p>' | strip_html }}
```

Output: `Hello world`

### strip\_newlines

Removes all newlines.

```aqua theme={null}
{{ product.description | strip_newlines }}
```

### newline\_to\_br

Converts newlines to `<br>` tags.

```aqua theme={null}
{{ "Line 1\nLine 2" | newline_to_br }}
```

Output: `Line 1<br>Line 2`

### replace

Replaces occurrences of a string.

```aqua theme={null}
{{ 'Hello World' | replace: 'World', 'Universe' }}
```

Output: `Hello Universe`

### replace\_first

Replaces the first occurrence only.

```aqua theme={null}
{{ 'Hello Hello' | replace_first: 'Hello', 'Hi' }}
```

Output: `Hi Hello`

### remove

Removes all occurrences.

```aqua theme={null}
{{ 'Hello World' | remove: 'World' }}
```

Output: `Hello `

### prepend

Adds text to the beginning.

```aqua theme={null}
{{ 'world' | prepend: 'Hello ' }}
```

Output: `Hello world`

### append

Adds text to the end.

```aqua theme={null}
{{ 'Hello' | append: ' world' }}
```

Output: `Hello world`

### split

Splits a string into an array.

```aqua theme={null}
{% assign tags = 'tag1,tag2,tag3' | split: ',' %}
{% for tag in tags %}{{ tag }}{% endfor %}
```

### handleize

Converts to URL-safe handle.

```aqua theme={null}
{{ 'Summer Collection 2024!' | handleize }}
```

Output: `summer-collection-2024`

### escape

HTML-escapes special characters.

```aqua theme={null}
{{ '<script>alert("hi")</script>' | escape }}
```

Output: `&lt;script&gt;alert("hi")&lt;/script&gt;`

### url\_encode

URL-encodes a string.

```aqua theme={null}
{{ 'hello world' | url_encode }}
```

Output: `hello%20world`

### url\_decode

URL-decodes a string.

```aqua theme={null}
{{ 'hello%20world' | url_decode }}
```

Output: `hello world`

### highlight

Wraps search terms in `<mark>` tags.

```aqua theme={null}
{{ product.title | highlight: search.terms }}
```

***

## Math Filters

### plus

Addition.

```aqua theme={null}
{{ 5 | plus: 3 }}
```

Output: `8`

### minus

Subtraction.

```aqua theme={null}
{{ 10 | minus: 3 }}
```

Output: `7`

### times

Multiplication.

```aqua theme={null}
{{ 5 | times: 3 }}
```

Output: `15`

### divided\_by

Division.

```aqua theme={null}
{{ 10 | divided_by: 2 }}
```

Output: `5`

### modulo

Remainder.

```aqua theme={null}
{{ 10 | modulo: 3 }}
```

Output: `1`

### round

Rounds to decimal places.

```aqua theme={null}
{{ 3.14159 | round: 2 }}
```

Output: `3.14`

### ceil

Rounds up.

```aqua theme={null}
{{ 3.1 | ceil }}
```

Output: `4`

### floor

Rounds down.

```aqua theme={null}
{{ 3.9 | floor }}
```

Output: `3`

### abs

Absolute value.

```aqua theme={null}
{{ -5 | abs }}
```

Output: `5`

### at\_least

Returns the larger value.

```aqua theme={null}
{{ 3 | at_least: 5 }}
```

Output: `5`

### at\_most

Returns the smaller value.

```aqua theme={null}
{{ 10 | at_most: 5 }}
```

Output: `5`

***

## Array Filters

### first

Returns the first item.

```aqua theme={null}
{{ product.images | first }}
```

### last

Returns the last item.

```aqua theme={null}
{{ product.images | last }}
```

### size

Returns the array length.

```aqua theme={null}
{{ cart.items | size }}
```

### join

Joins array elements.

```aqua theme={null}
{{ product.tags | join: ', ' }}
```

### sort

Sorts an array.

```aqua theme={null}
{% assign sorted = collection.products | sort: 'price' %}
```

### sort\_natural

Case-insensitive sort.

```aqua theme={null}
{% assign sorted = collection.products | sort_natural: 'title' %}
```

### reverse

Reverses an array.

```aqua theme={null}
{% assign reversed = collection.products | reverse %}
```

### uniq

Removes duplicates.

```aqua theme={null}
{{ product.tags | uniq | join: ', ' }}
```

### compact

Removes nil values.

```aqua theme={null}
{% assign clean = array | compact %}
```

### map

Extracts a property from each item.

```aqua theme={null}
{{ product.variants | map: 'title' | join: ', ' }}
```

### where

Filters by property value.

```aqua theme={null}
{% assign available = product.variants | where: 'available', true %}
```

### find

Finds first matching item.

```aqua theme={null}
{% assign large = product.variants | find: 'title', 'Large' %}
```

### reject

Removes matching items.

```aqua theme={null}
{% assign non_default = customer.addresses | reject: 'default', true %}
```

### concat

Combines arrays.

```aqua theme={null}
{% assign all = array1 | concat: array2 %}
```

### slice

Extracts a portion.

```aqua theme={null}
{{ 'hello' | slice: 0, 3 }}
{{ product.tags | slice: 0, 5 }}
```

***

## Date Filters

### date

Formats a date.

```aqua theme={null}
{{ article.published_at | date: '%B %d, %Y' }}
{{ 'now' | date: '%Y-%m-%d' }}
```

**Format codes:**

| Code | Output       |
| ---- | ------------ |
| `%Y` | 2024         |
| `%m` | 05           |
| `%d` | 04           |
| `%B` | May          |
| `%b` | May          |
| `%A` | Saturday     |
| `%a` | Sat          |
| `%H` | 14 (24-hour) |
| `%I` | 02 (12-hour) |
| `%M` | 30           |
| `%S` | 45           |
| `%p` | PM           |

### time\_tag

Generates a `<time>` tag.

```aqua theme={null}
{{ article.published_at | time_tag }}
{{ article.published_at | time_tag: format: '%B %d' }}
```

***

## Color Filters

### color\_to\_rgb

Converts hex to RGB.

```aqua theme={null}
{{ '#ff0000' | color_to_rgb }}
```

Output: `rgb(255, 0, 0)`

### color\_to\_hex

Converts to hex.

```aqua theme={null}
{{ 'rgb(255, 0, 0)' | color_to_hex }}
```

Output: `#ff0000`

### color\_lighten

Lightens a color.

```aqua theme={null}
{{ '#ff0000' | color_lighten: 20 }}
```

### color\_darken

Darkens a color.

```aqua theme={null}
{{ '#ff0000' | color_darken: 20 }}
```

### color\_brightness

Returns brightness (0-100).

```aqua theme={null}
{{ '#ff0000' | color_brightness }}
```

### color\_modify

Modifies color properties.

```aqua theme={null}
{{ settings.color_primary | color_modify: 'alpha', 0.5 }}
```

***

## Font Filters

### font\_face

Generates CSS `@font-face` rules.

```aqua theme={null}
{{ settings.type_body_font | font_face }}
```

### font\_url

Returns the font URL.

```aqua theme={null}
{{ settings.type_body_font | font_url }}
```

### font\_property

Extracts a font property.

```aqua theme={null}
{{ settings.type_body_font | font_property: 'family' }}
{{ settings.type_body_font | font_property: 'weight' }}
{{ settings.type_body_font | font_property: 'style' }}
```

### font\_modify

Modifies font properties.

```aqua theme={null}
{{ settings.type_body_font | font_modify: 'weight', 'bold' }}
```

***

## HTML Filters

### link\_to

Creates an anchor tag.

```aqua theme={null}
{{ 'Click here' | link_to: product.url }}
{{ 'Click here' | link_to: product.url, class: 'btn' }}
```

Output: `<a href="/products/handle">Click here</a>`

### link\_to\_vendor

Links to vendor collection.

```aqua theme={null}
{{ product.vendor | link_to_vendor }}
```

### link\_to\_type

Links to product type collection.

```aqua theme={null}
{{ product.type | link_to_type }}
```

### link\_to\_tag

Links to tag filter.

```aqua theme={null}
{{ 'Summer' | link_to_tag: tag: 'summer' }}
```

***

## Utility Filters

### json

Converts to JSON.

```aqua theme={null}
<script>
  var product = {{ product | json }};
</script>
```

### parse\_json

Parses a JSON string into an object.

```aqua theme={null}
{% assign data = '{"name": "Test", "price": 99}' | parse_json %}
{{ data.name }} - {{ data.price }}
```

Output: `Test - 99`

### inline\_asset\_content

Inlines the content of an asset file (useful for SVGs).

```aqua theme={null}
{{ 'icon-cart.svg' | inline_asset_content }}
{{ 'logo.svg' | inline_asset_content }}
```

Output: The raw SVG markup inlined directly into the HTML.

<Tip>
  Use this for SVG icons to avoid extra HTTP requests and enable CSS styling of SVG elements.
</Tip>

### default

Returns default if value is nil/empty.

```aqua theme={null}
{{ product.metafields.custom.subtitle | default: 'No subtitle' }}
```

### t (translate)

Translates a key from locales.

```aqua theme={null}
{{ 'products.add_to_cart' | t }}
{{ 'products.items_count' | t: count: 5 }}
```

### placeholder\_svg\_tag

Generates a placeholder SVG.

```aqua theme={null}
{{ 'product-1' | placeholder_svg_tag }}
{{ 'collection-1' | placeholder_svg_tag: class: 'placeholder' }}
```

### weight\_with\_unit

Formats weight with unit.

```aqua theme={null}
{{ variant.weight | weight_with_unit }}
```

### format\_address

Formats an address object.

```aqua theme={null}
{{ customer.default_address | format_address }}
```

### default\_errors

Renders `form.errors` as a ready-made error list. Used inside
[`{% form %}`](/aqua/tags#form) blocks — see
[Theme Customer Accounts](/aqua/customer-accounts#form-state-errors-and-success).

```aqua theme={null}
{% form 'customer_login' %}
  {{ form.errors | default_errors }}
  ...
{% endform %}
```

### default\_pagination

Renders a complete pagination control from the `paginate` object inside a
`{% paginate %}` block.

```aqua theme={null}
{% paginate customer.orders by 20 %}
  ...
  {{ paginate | default_pagination }}
{% endpaginate %}
```

### structured\_data

Generates JSON-LD for SEO.

```aqua theme={null}
{{ product | structured_data }}
```

Output: Complete Product schema JSON-LD

***

## Payment Filters

### payment\_type\_img\_url

Returns payment method icon URL.

```aqua theme={null}
<img src="{{ 'visa' | payment_type_img_url }}" alt="Visa">
```

### payment\_type\_svg\_tag

Renders payment method SVG.

```aqua theme={null}
{{ 'visa' | payment_type_svg_tag }}
{{ 'mastercard' | payment_type_svg_tag: class: 'payment-icon' }}
```

***

## Video Filters

### external\_video\_url

Extracts embed URL from YouTube/Vimeo.

```aqua theme={null}
{{ 'https://youtube.com/watch?v=abc123' | external_video_url }}
```

### external\_video\_tag

Renders an iframe for external video.

```aqua theme={null}
{{ 'https://youtube.com/watch?v=abc123' | external_video_tag }}
```

### video\_tag

Renders a `<video>` element.

```aqua theme={null}
{{ product.media[0] | video_tag: autoplay: false, controls: true }}
```

***

## Metafield Filters

Access metafield values with type-aware output.

```aqua theme={null}
{{ product.metafields.custom.care_instructions }}
{{ product.metafields.custom.warranty_years | append: ' years' }}
```

For reference metafields (product, collection, etc.):

```aqua theme={null}
{% assign related = product.metafields.custom.related_products.value %}
{% for item in related %}
  {{ item.title }}
{% endfor %}
```
