Mity Docs Mity Docs for Mity Digital
Variable Number Fieldtype Documentation

Currency formatting

Currency formatting is performed using PHP's NumberFormatter. This requires the intl extension.

If your site is not configured correctly, you may see unexpected currency formatting.

Set your site locale

In your config/statamic/sites.php file, you must ensure that the locale is set to your locale.

It sounds obvious, but this is really important.

For example, in Australia, we must configure our site as en_AU.

What happens if you don't

If you don't have the correct locale set, the NumberFormatter will present unexpected results.

In Statamic, the default locale is en_US. If you use the Variable Number fieldtype for a Currency format in AUD, you will see:

1AUD is formatted as A $5.00
2USD is formatted as $5.00

This is not expected for Australian users - we would expect simply $5.00.

When the site locale is correctly set to en_AU, we see the correct AUD formatted:

1AUD is formatted as $5.00
2USD is formatted as USD 5.00

The way NumberFormatter works can differ based on your server and its configuration. Take care to ensure your server, sites and field are correctly configured for your audience.