Magento – How to show currency symbol and price in separate elements

catalog-price-rulesmagento-2.1magento2price

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

into this:

<span>BD</span><span>18.00</span>

is it achievable?

Best Answer

<?php 
$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>"; 
?>
Related Topic