---
title: Customize Emails with Liquid Examples
url: https://docs.maxio.com/configuration/advanced-billing/email-settings/liquid-examples
applies_to: Advanced Billing
updated: 2026-10-26
---

# Customize Emails with Liquid Examples

Liquid lets an email template do more than drop a value into a sentence. It can branch on the product a subscriber bought, reformat a number, or reshape a name. The snippets below are worked examples of the patterns that come up most often, ready to adapt for your own templates.

> **WARNING:** These snippets are provided as a reference and as-is. Test any snippet you adopt across the subscription lifecycle before it reaches real subscribers. You're responsible for making the code work for your own subscriptions and for maintaining it afterward, including any modifications you make.

## Capitalize a subscriber's name

`{{name}}` returns the subscriber's first name only, so there's no need to include it separately in the body. This snippet normalizes the capitalization of whatever it returns.

```liquid
{% assign nameparts = name | split: ' ' %}
{% capture titlecase %}{% for word in nameparts %}{{ word | downcase | capitalize }}{% endfor %}{% endcapture %}{{ titlecase }}
```

## Display tax on a receipt

Subtract the product price from the amount actually paid, then convert the result from cents to your currency's main unit.

```liquid
{{payment.amount_in_cents | minus: product.price_in_cents | times: 0.01 }}
```

## Swap the thousands separator

`{{payment.amount}}` returns a formatted amount such as `$1,234.56`. This snippet replaces the comma with a period, giving `$1.234.56`, for locales that group thousands that way. It doesn't change the decimal separator.

```liquid
{{ payment.amount | replace:',','.' }}
```

## Display only the last 4 digits of a card

`{{payment_profile.masked_card_number}}` returns the full mask, `XXXX-XXXX-XXXX-1234`. Removing the padding characters *and* the hyphens leaves just `1234`.

```liquid
{{ payment_profile.masked_card_number | remove: "X" | remove: "-" }}
```

> **Important:** Removing only the `X` characters leaves the hyphens in place, which renders as `---1234`. Both filters are needed.

## Vary text by payment method

Send different wording to automatic-pay subscribers than to invoiced ones. This works well in receipts.

```liquid
Dear {{name}}
[Your email content here.]
{% if subscription.payment_collection_method == "automatic" %}
Text for automatic-based subscriber.
{% elsif subscription.payment_collection_method == "invoice" %}
Text for invoice-based subscriber.
{% endif %}
Cheers,
{{merchant_name}}
```

`payment_collection_method` can also return `remittance` or `prepaid`, though never alongside `invoice` on the same site. Sites using invoice-centric billing can see `automatic`, `remittance`, or `prepaid`; sites that don't use it can see `automatic` or `invoice` instead. Add a branch for whichever of these your site actually uses, or the `else` case will catch those subscribers.

## Vary text by product

Single out one product and give everyone else the same wording:

```liquid
{% if product.handle =="REPLACE" %}
Your content based on the above product handle
{% else %}
[The content you would like to send other subscribers not purchasing the product handle specified above]
{% endif %}
```

Give several products their own wording:

```liquid
{% if product.handle =="REPLACE" %}
Your content based on the above product handle
{% elsif product.handle =="OTHER_HANDLE" %}
Your content based on the above product handle
{% elsif product.handle =="ANOTHER_HANDLE" %}
Your content based on the above product handle
{% else %}
[The content you would like to send other subscribers not purchasing the product handle specified above]
{% endif %}
```

Give a group of products the same wording, by testing several handles in one condition:

```liquid
{% if product.handle == "[REPLACE_WITH_product_handle]" or product.handle == "[REPLACE_WITH_product_handle]" or product.handle == "[REPLACE_WITH_product_handle]" %}
Here is the text your subscriber sees if they purchased any of the products above.
{% endif %}
```

## Link to a URL

Surround the address with angle brackets to turn it into a link.

```liquid
<https://example.com/my_page> or <{{subscription.billing_portal_management_url}}>
```

To attach a link to specific words instead, use a Markdown reference link. Put the label in the sentence and the address on its own line:

```markdown
To speak with one of our experts, [click here][1].

[1]: http://www.example.com
```

For a general introduction to the language, see <a href="https://shopify.github.io/liquid/basics/introduction/" target="_blank" rel="noopener noreferrer">Shopify's Liquid syntax introduction</a>.

For the full list of filters, including the math operators used above, see <a href="https://shopify.dev/docs/api/liquid#modifying-output-with-filters" target="_blank" rel="noopener noreferrer">Shopify's Liquid filter reference</a>.
