1

I am trying to dynamically update the currency symbol (based on a users custom customer attribute). I have a plugin afterGetCurrency which is loading correctly, and I can get the current symbol but how do I override it?

<?php
namespace Sulman\MyModule\Plugin;

class CurrencySymbolSwitch
{
    /**
     * @param \Magento\Framework\Locale\Currency $subject
     * @param \Magento\Framework\Currency $result
     * @return mixed
     */
    public function afterGetCurrency(
        \Magento\Framework\Locale\Currency $subject,
        $result,
        $currency
    ) {
        var_dump($result->getSymbol()); // this is working
        // but how do I change it?
        $result->setSymbol('O'); // Uncaught Error: Call to undefined method Magento\Framework\Currency::setSymbol()
        return $result;
    }
}

I don't want to change the currency, just change the symbol.

Any ideas? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.