How can I format prices with a comma thousands separator and always two decimal places?

You can use the format_as_money() function in the Calculated Fields to do this:

Examples:

Format the "total_price" field with a thousands separator and 2 decimal places.

format_as_money({{ total_price }})

If the value of "total_price" is "1000", this will output: 1,000.00

Format the "total_price" field without a thousands separator, but with 2 decimal places.

format_as_money({{ total_price }}, thousands_separator=False)

If the value of "total_price" is "1000", this will output: 1000.00

Format the "total_price" field and add a "$" symbol in front and " USD" at the end.

"$" + format_as_money({{ total_price }}) + " USD"

If the value of "total_price" is "12345.95", this will output: $12,345.95 USD


Related Articles:


App: EZ Exporter

Tags: formatting