0

I need to currency rate by currency code in magento 2.

$currency =  $objectManager->get('Magento\Framework\Pricing\PriceCurrencyInterface');
$currencySymbol = $currency->getRate('USD');

I tried above code it returns fatal error.

1 Answer 1

1

I reckon you should use Magento\Directory\Model\Currency class instead of Magento\Framework\Pricing\PriceCurrencyInterface.

On top of that, I suggest you never use the object manager directly and use dependency injection instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.