0

How to remove comma separator from the price in magento2.1 Product List and Product page?

0
0

to remove decimals , you just need to install the free module Currency Formatter Extension from Mageplaza here the link : https://www.mageplaza.com/magento-2-currency-formatter/  .

Than you can disable the decimal from magento admin panel ->stores->configuration-> Mageplaza Extensions. 

This worked for me in magento 2.3.3 installation . 

Best regards

-1

this question is asked before, check solution provided here :

How to change currency format in Magento 2?

2
  • In this code working correctly ?? this code suitable for my exacty questions ?? – udhayakumar Dec 5 '17 at 6:09
  • i have not tried it myself but you have to create custom module for that as per answered on reference post. – Naveed Asim Dec 5 '17 at 7:56
-1

overright

vendor/magento/module-catalog/view/base/templates/product/price/amount/default.html

to

app/design/[your module]/Magento_Catalog/templates/product/price/amount/default.html 

and replace the content with:

<?php /** @var \Magento\Framework\Pricing\Render\Amount $block */ ?>

<span class="price-container <?= /* @escapeNotVerified */ $block->getAdjustmentCssClasses() ?>"
        <?= $block->getSchema() ? ' itemprop="offers" itemscope itemtype="http://schema.org/Offer"' : '' ?>>
    <?php if ($block->getDisplayLabel()): ?>
        <span class="price-label"><?= /* @escapeNotVerified */ $block->getDisplayLabel() ?></span>
    <?php endif; ?>
    <span <?php if ($block->getPriceId()): ?> id="<?= /* @escapeNotVerified */ $block->getPriceId() ?>"<?php endif;?>
        <?= ($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?>
        data-price-amount="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>"
        data-price-type="<?= /* @escapeNotVerified */ $block->getPriceType() ?>"
        class="price-wrapper <?= /* @escapeNotVerified */ $block->getPriceWrapperCss() ?>"
    ><?php $my_str1 =  /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()); 

    echo str_replace("٫", ".", $my_str1);
    ?>
    </span>
    <?php if ($block->hasAdjustmentsHtml()): ?>
        <?= $block->getAdjustmentsHtml() ?>
    <?php endif; ?>
    <?php if ($block->getSchema()): ?>
        <meta itemprop="price" content="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>" />
        <meta itemprop="priceCurrency" content="<?= /* @escapeNotVerified */ $block->getDisplayCurrencyCode() ?>" />
    <?php endif; ?>
</span>

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.