Price formatting
Format prices consistently across your theme.
See also: Price object and Money filters
Price objects can be rendered directly for simple use cases.
For example:
{{ variant.price }}might render as:
€200.00 /ppThe output automatically includes:
- The correct currency symbol.
- A pricing suffix such as
/ppor/night, depending on the pricing model.
Formatting derived prices
If you call a method or apply a filter to a Price object, the result is another object rather than a formatted string.
For example:
{{ variant.price | apply_promotion: variant.promotion }}returns a VariantPriceDrop, not a formatted price.
To display the result, access one of its price properties and format it with the money filter.
Recommended approach
For consistent formatting throughout your theme, we recommend always:
- Accessing the price through
fractionalorper_person_fractional. - Formatting the value with the
moneyfilter. - Adding any pricing suffix (
/pp,/night,/unit) in your own markup where appropriate.
For example:
{{ variant.price.fractional | money: no_cents_if_whole: true }}renders:
€200Or, for a per-person price:
{{ variant.price.per_person_fractional | money: no_cents_if_whole: true }} /pprenders:
€100 /ppThis approach ensures prices are formatted consistently, regardless of whether they are original prices, promotional prices, deposits, or payment plan amounts.