Money Filters
Money filters format numeric values as currency.
Formats a value in cents as a dollar amount with a $ prefix.
Syntax:
{{ cents | money }}Input: A number representing the amount in cents.
Output: A formatted currency string.
{{ 1999 | money }}{{ 5000 | money }}{{ 99 | money }}{{ 10000 | money }}$19.99$50$0.99$100Example Usage
Section titled “Example Usage”Displaying ticket prices:
{% if event.price %} <span class="price">{{ event.price | money }}</span>{% endif %}Price ranges:
{% if event.minPrice and event.maxPrice %} <span class="price-range"> {{ event.minPrice | money }} – {{ event.maxPrice | money }} </span>{% elsif event.price %} <span class="price">{{ event.price | money }}</span>{% else %} <span class="price">Free</span>{% endif %}With conditional formatting:
{% assign price_cents = event.price %}{% if price_cents == 0 %} <span class="price price--free">Free</span>{% elsif price_cents < 2000 %} <span class="price price--budget">{{ price_cents | money }}</span>{% else %} <span class="price">{{ price_cents | money }}</span>{% endif %}