Is there a way to add an own currency? Like "Points".
I tried to write a plugin to intercept after \Magento\Directory\Model\PriceCurrency::getCurrencySymbol
but it seems, that this method is not used to format price for frontend.
My Plugin looks like
class PluginAfter
{
/**
* @param string $interceptedInput
* @param string $interceptedOutput
*
* @return string 'Points'
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterGetCurrencySymbol($interceptedInput, $interceptedOutput)
{
die('getCurrencySymbol'); // not triggered
return __('Points');
}
So i tried to intercept \Magento\Directory\Model\PriceCurrency::getCurrency
but there is no option to set new currencysymbol
Any suggestions?
Best Answer
Thanks for pointing out the file,
I can add that is no need to implement an observer for that.
You can add a
customsymbol
node in your own module inconfig.xml
:Where RON is my currency code ( similar to USD for american dollar ), and Lei is my new currency symbol I want to use.
Notice that the accepted value is only a serialized array with currency code as key and custom currency symbol as value.
Thanks!