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

into this:


is it achievable?

$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 '17 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.