4

I am new to Magento, I am trying to remove the euro currency symbol from the product page, in Magento 2.3.

In the following file it seems that I can adjust the price, value, and currency:

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

Is it possible to remove the currency symbol by adjusting this file?

The following code is displayed in this file

<?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() ?>"
    ><?= /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?></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>
1

1 Answer 1

5

For the product page I think you can look at vendor/magento/module-catalog/view/base/web/js/price-box.js

Around line no 149 you will see price.formatted = utils.formatPrice(price.final, priceFormat);

You check it in console.log(price.formatted); it will show the string which is displaying at the product page.

So you can change it as your requirement like below.

price.formatted = utils.formatPrice(price.final, priceFormat);
price.formatted = price.formatted.replace("$", "");

If this does not work then you can try out this as well. Maybe it helps.

1
  • The Amasty link is for attributes not product price. Altough the preg replace might be usefull.
    – Akif
    Commented Aug 18, 2022 at 13:52

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.