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.
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.
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.