View Formatted Number
view_formatted_number formats a numeric value for display using CartThrob/ExpressionEngine number-format behavior.
Implementation note: this tag directly returns:
ee()->number->format($this->param('number'))
Use this tag when you need to format an arbitrary numeric value in templates (not only cart totals).
See also:
Parameters
In addition to number, templates commonly use shared number-format settings/overrides documented on Global Number Formatting.
number
Numeric value to format.
number="12"
Behavior and Constraints
- This is an immediate-execution single tag.
- The tag passes only
numberdirectly into the number formatter. - Output is a formatted display value (not a calculation-safe numeric type).
- For comparisons/calculations, use numeric outputs from source tags (for example
:numericvariants) and format only at final display time.
Examples
Basic formatting:
{exp:cartthrob:view_formatted_number number="12.1234"}
Common formatting override usage (as used in installer/stub examples):
{exp:cartthrob:view_formatted_number number="12.1234" prefix="$" decimals="2"}
Format a computed number:
{exp:cartthrob:view_formatted_number number="{exp:cartthrob:arithmetic expression='12.1234 * 2'}"}