Link Search Menu Expand Document

Price formatting

If no method is called on a Price object, it will default to showing with the currency symbol and either /pp or /night depending on the per person, unit, or night pricing.

e.g. {{ variant.price }} might render as €200.00/pp

This is great for basic use cases. However, if a Price object has had a method called on it, e.g. when applying promotions the return value is another drop.

e.g {{ variant.price | apply_promotion: variant.promotion }} might render VariantPriceDrop.

To format prices consistently across a site, we therefore recommend always using the fractional or per_person_fractional prices, applying the money filter, and adding a suffix of per something where needed. You can further format prices with the money filter attribute no_cents_if_whole

e.g. {{ variant.price | money }} might render as €200.00
so {{ variant.price.fractional | money: no_cents_if_whole: true }} would render as €200
and {{ variant.price.per_person_fractional | money: no_cents_if_whole: true }} might render as €100