1

I managed to remove the decimals .00 from catalog.

But, I'm not able to remove from product view & the checkout

Please help me.

Thank you.

  • Can you explain more, from where you remove decimals? – Chirag Patel May 11 '18 at 8:59
  • I removed from vendor/magento/module-catalog/view/base/web/js/price-utils.js – Valerio Vini May 11 '18 at 9:01
2

Create file and use this code :

=> From :

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

=> To :

app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml

this file is defined from \Magento\Framework\Pricing\Render\Amount

The price itself is coming from this call:

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

If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)

Update line no 24

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

To

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

You need to override

vendor/magento/module-catalog/view/base/web/js/price-utils.js

To

app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js

and change the value of precision on line 38:

var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,

To

var precision = 0,
| improve this answer | |
  • /vendor/magento/framework/Pricing/Render/Amount.php Dont have that cose in line 24. . class Amount extends Template implements AmountRenderInterface – Valerio Vini May 11 '18 at 9:27
  • Read my updated answer. From vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml this path. create file on mention path and update this line. – Rohan Hapani May 11 '18 at 9:35
  • Done ,Created path and file ,Updated line 24 . Still same . pp/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js doesnt exist . We have porto theme installed – Valerio Vini May 11 '18 at 12:13
  • In public_html/app/design/frontend/Smartwave/porto/Magento_Catalog/web/js. we have only jquery.zoom.min.js We have porto theme installed – Valerio Vini May 11 '18 at 12:25
  • You need to create it. It's not already generated there. – Rohan Hapani May 11 '18 at 12:34

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.