[[ ... ]], data-condition, data-ef-text, and similar attributes can call built-in functions. You can also register custom functions with registerTemplateFunction(name, fn) or registerTemplateFunctions({ name: fn, ... }).
Price display: when to use formatPrice vs as-is
Most checkout and cart values are already formatted (e.g. "$29.00"). Use them directly in [[ ... ]]. Use formatPrice() only when you need to display a raw number (e.g. *_raw keys or a computed number).
- Use as-is (no formatPrice)
- Use formatPrice (raw numbers)
These are pre-formatted. Use
[[ variable ]] only.In template:
[[ checkout.total ]], [[ item.price ]], [[ bump.price ]]formatPrice(value, currency?, locale?) / money / formatCurrency
Formats a numeric value as currency.
Cart helpers
String helpers
All coerce to string;null/undefined become empty string.
Custom functions
Register from application or plugin code:[[ myFormat(item.name) ]], [[ double(item.quantity) ]], [[ greet(checkout.customer.first_name) ]].
Summary
- Price display: Use the table above: pre-formatted keys as-is; formatPrice only for raw values or computed numbers.
- Cart:
cartCount,cartSubtotal,lineTotal; combine with formatPrice when you need a formatted string from a number. - Strings:
upper,lower,capitalize,titleCase,camelCase,snakeCase,kebabCase(and aliases). - Custom:
registerTemplateFunction/registerTemplateFunctions.