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.

Raphael at Digital Pianism
  • 70,385
  • 34
  • 188
  • 352
Deeban Babu
  • 505
  • 10
  • 23

1 Answers1

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.

Raphael at Digital Pianism
  • 70,385
  • 34
  • 188
  • 352