I want to show currency symbol and amount in separate html elements such as: BD18.00

into this:


is it achievable?

  • Heyy.. Did you get anything? Aug 5, 2020 at 4:33

4 Answers 4

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterfa‌​ce'); 
$currencyCode = $storeManager->getStore()->getCurrentCurrencyCode(); 
$currency = $objectManager->create('Magento\Directory\Model\CurrencyFact‌​ory')->create()->loa‌​d($currencyCode); 

echo "<span>{$currency->getCurrencySymbol()}</span><span>{$product->getPrice()}</span>"; 
  • I can show in this way, but I want it to behave like default price like changing custom option, will change price as well.
    – Manish Joy
    Nov 20, 2017 at 5:32

You can change the price format by change theme files.


Just replace or comment

<?= /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>

and add the following snippet

<span class="av-new-price"><?= $block->getDisplayCurrencyCode() ?></span>
    <span class="av-amount"><?php echo number_format($block->getDisplayValue(),2) ?></span>

If this file not in your directory just overrides.


You can use below code to get the currency symbol and currency code in your template file:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface')->getStore();
$currencyCode = $storeManager->getCurrentCurrencyCode();
$currencyFactory = $objectManager->create('Magento\Directory\Model\CurrencyFactory');
$currency = $currencyFactory->create()->load($currencyCode);
$currencySymbol = $currency->getCurrencySymbol();
$productPrice = $_product->getPrice();
$productFinalPrice = $_product->getFinalPrice();
echo "<span class='cur-code'>".$currencyCode."</span>"; // prints currency code of your current store. E.g. 'USD' OR 'EUR' OR 'GBP' OR 'INR' etc..
echo "<span class='cur-symbol'>".$currencySymbol."</span>"; // prints currency symbol of your current store. E.g. '$' OR '€' OR '£' OR '₹' etc..
echo "<span class='prod-price'>".$productPrice."</span>";// prints product's price value.
echo "<span class='final-price'>".$productFinalPrice ."</span>";// prints value of product's final price.

This is a tested code and will print the values as per your current store or as per the active currency switcher.

Hope this will help you! :)


try this below code

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

$currencysymbol = $objectManager->get('Magento\Store\Model\StoreManagerInterface');

$currency = $currencysymbol->getStore()->getCurrentCurrency();

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.