Adjusting currency

Silverstripe Version: 4.4

Question:

I want default currency symbol in currency field to be € rather than $. How do I set this?

Thanks for any help.

    private static $db = [
        'Price' => 'Currency',
    ];

    ...

    public function getCMSfields()
    {
        ...
        $fields->addFieldsToTab('Root.Main', [
            CurrencyField::create('Price'),
        );
        ...
    }

There’s a config variable in the DBCurrency class, so you should be able to set it in your YML config file:

SilverStripe\ORM\FieldType\DBCurrency:
  currency_symbol: '€'

3 Likes