4

I am trying to show item price with symbol in override email template on order create, and my site have euro and $ both currency.

Is there any way to get current currency symbol, Please share if have.

4
  • 1
    protected $this->storeManage; \Magento\Store\Model\StoreManagerInterface $storeManage $this->storeManage = $storeManage $this->storeManager->getStore()->getCurrentCurrencyCode();
    – Jackson
    Dec 28, 2016 at 6:20
  • 1
    protected causes error Dec 28, 2016 at 7:13
  • what you mean by current currency symbol
    – Amit Bera
    Dec 28, 2016 at 7:59
  • current currency symbol means when I am going to create a order by backend. There is dropdown to select currency for order, Dec 28, 2016 at 8:59

4 Answers 4

2

Try to use

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$priceHelper = $objectManager->get('Magento\Framework\Pricing\Helper\Data');
$priceHelper->currency($YOURPRICE, true, false);

Maybe it will help you.

1
  • It is working fine for euro....But when switching to $ price is coming in round figure Dec 28, 2016 at 6:50
1

I donot know,what extract you want.

In magento, whenever a system have multiple currencies means system have a base currency and have multiple currencies. And multiple currencies manage via rate,

Then whensoever an order placed at system and then base currency and order place time currency both codes are save at order table sales_order.

You can find

base currency code from base_currency_code field

order time currency code from order_currency_code

1
  • Actully amit, I override a email template where I need to show item price, priceFormatter($_item->getPrice()) by this price is coming but in round, like 0.73 will be 8 Dec 28, 2016 at 8:45
1

To get the Currency Symbol :

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$priceHelper = $objectManager->create('Magento\Framework\Pricing\Helper\Data');

$price =  1000; //Your Price

$formattedPrice = $priceHelper->currency($price, true, false);
1

Currency code and symbol:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currencysymbol= $objectManager
->get('Magento\Store\Model\StoreManagerInterface');
$currencyCode = $currencysymbol->getStore()->getCurrentCurrencyCode();
$currency  = $objectManager
->create('Magento\Directory\Model\CurrencyFactory')
->create()->load($currencyCode);
$currencySymbol= $currency->getCurrencySymbol();

Simple way to get price with currency

$this->helper('Magento\Framework\Pricing\Helper\Data')->currency($price,true,false); //$price is final amount

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.