Format Numbers With Thousands Separators

I have created a new email module via the design tools. Within that module, I have created a field name starting_price that is configured as a number. I’d like to use said field in the HTML/Hubl with thousands separators.

[

Screen Shot 2018-07-19 at 10.11.57 AM.png326x603 18.2 KB

](https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/d/d0038e402d34aec0aeacad1672382fe80cab5c46.png)

When someone uses this module when creating a new marketing email, they are asked enter starting price but the number is not formatted with thousands separators. For example, if the price is $1,899, the user enters 1899 in the email field form (HubSpot adds the comma in the starting price input form field), but it’s also being displayed as 1899 in the email template.

[

Screen Shot 2018-07-19 at 10.15.45 AM.png529x548 20 KB

](https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/9/9c1834630298be6b8abe937d1dd428a5515cb452.png)

I’d like to format the number to be formatted with thousands separators without asking the user to enter a string in the form input.

Thoughts?

Thanks!

Any ideas or suggestions?

I think you’ll have to go the string option. Ideally you’d store the number in the DB without the formatting and apply the formatting in the template.

For anyone who’s still looking for the solution.

Hubl has some filters available: you can use format_currency(“en-US”) for thousand separator. It’ll also add a “$” sign in front of the number.

if item.price = 2500

Ex: {{ item.price | format_currency(“en-US”) }} ==> output $2,500

Unfortunately no easy way to do this other than combining the format_currency and replace filters (kinda feel like there should be a format_number filter)

{{ my_number|format_currency('en-US')|replace('$', '') }}