Pricing
Format and manipulate prices in Easol themes.
Pricing filters help you display and manipulate monetary values in Easol themes.
Easol provides filters for formatting prices, applying promotions, and extracting numeric values from formatted price strings.
Format money
Use the money filter to display prices in the customer's selected currency.
The filter expects an integer representing the fractional (minor) unit of the currency. For example, 7500 represents £75.00.
{{ 150 | money }}Assuming the customer's currency is GBP, this renders:
£1.50The money filter also supports formatting options.
For example:
{{ variant.price.fractional | money: no_cents_if_whole: true }}See the Price formatting guide for recommended usage.
Apply promotions
Use apply_promotion to calculate the discounted price for a promotion.
The filter returns a Price object, allowing you to continue working with the result using the standard price properties.
{% assign reduced_price = price | apply_promotion: promotion %}
{{ reduced_price.fractional | money }}Assuming an original price of £120.00 and a 25% promotion, this renders:
£90.00apply_promotion returns a Price object, not a formatted string. Access one of its price properties (such as fractional)
before applying the money filter.
Extract numeric values
Use extract_money_decimal to extract the numeric value from a formatted price string.
{{ "$1,020.89/pp" | extract_money_decimal }}This renders:
1020.89This filter is useful when working with formatted price strings that need to be parsed before further processing.
Choosing the right filter
| Filter | Use when |
|---|---|
money | Display a monetary value in the customer's selected currency. |
apply_promotion | Calculate a promotional price from a Price object. |
extract_money_decimal | Extract the numeric value from a formatted price string. |