Currency format

Why does |currency - October CMS - 3.x

dd(\Currency::format(123, [‘format’ => ‘long’]));

returns “$1.23 USD”

?

Hi @mkinternet,

Take a look at this documentation: |currency - October CMS - 3.x

The way the currency is displayed depends on how it’s set up.

  • 'format' => 'long' uses the decimal settings from your Currency configuration.
  • 'format' => 'short' drops the decimals and currency label set in the Currency settings.

To adjust this, go to {yourinstallation}/{youadminarea}/responsiv/currency/currencies, open your default currency, and check the “Formatting” tab. Changing the decimal places here will impact how the currency is shown.

For example, with your current setup:

With 2 decimals:

  • Currency::format(123, ['format' => 'long']) → “$1.23 USD”
  • Currency::format(123, ['format' => 'short']) → “$1”

With 3 decimals:

  • Currency::format(123, ['format' => 'long']) → “$0.123 USD”
  • Currency::format(123, ['format' => 'short']) → “$0”
1 Like