Global Number Formatting Options

Most CartThrob tags that output numbers can accept the parameters below to control whether or not commas, decimals, currency symbols and other formatting are included. All numbers must be input using standard English notation for numbers (1,000.00 or 1000.00), but can be output in your desired format using the parameters below.

Table of Contents

Parameters

decimals

"Decimals" sets the level at which decimals will be rounded in the total. If your items are priced at $1.23456, setting the decimal parameter to "2" would round that number to $1.23. "2" is the default.

decimals="2"
dec_point

The default for this parameter is "." The primary use of this parameter is to account for countries that use a comma rather than a period as the decimal separator

dec_point="."
thousands_sep

"," is the default. The primary use of this parameter is to account for countries that use a period rather than a comma as the thousands separator

thousands_sep=","
prefix

If you'd like the total price prefixed with a monetary identifier, use this parameter. $ is the default set for this item. Setting it to blank "" will allow you to use the cart_total in conditionals to test for a specific total amount.

prefix="$"

Examples

The following example would output a number like this "Euro 1.000,00"

{exp:cartthrob:cart_total decimals="2" dec_point="," prefix="Euro " thousands_sep="."}