Currently the price is Rs 1,599.00 After 45% discount the price will be Rs 879.45.

I want that the price will be round off i.e Rs 879 and then when we choose the quantity to be 18 then the subtotal price will be 15822

Check Below screens for reference.

  1. https://prnt.sc/jsdn9b
  2. https://prnt.sc/jsdnh1

I dont want that price will be displayed in the decimal form like subtotal,shipping,discount,tax etc etc.

I'm using Magento 2.2.2

4 Answers 4


I have modified a method convert of file Magento\Directory\Model\Currency.

declaring a plugin, file Vendor/Module/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
<type name="Magento\Directory\Model\Currency">
    <plugin name="vendor_module" type="Vendor\Module\Model\Plugin\Currency" />

plugin model, file Vendor/Module/Model/Plugin/Currency.php

namespace Vendor\Module\Model\Plugin;
use Magento\Framework\Exception\InputException;

class Currency
    public function aroundConvert($subject, $proceed, $price, $toCurrency = null)
        $price = $proceed($price, $toCurrency);     
        // you logic
        // warning ... logic affects the price of shipping  
        return $price;

Also see Complete code on GitHub


Create file and use this code :

=> From :


=> To :


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()) ?>


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

You need to override




and change the value of precision on line 38:

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


var precision = 0,
  • This solution did not work for me. Jun 8, 2018 at 9:32
  • can you tell me where issue generated ? Jun 8, 2018 at 11:35
  • I already check that and it's working for me. There are something going wrong. Please check it. Jun 8, 2018 at 11:55

We need to override Magento\Catalog\Model\Product file like below :

Create /Vendor/Module/etc/di.xml and copy below code:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  <type name="Magento\Catalog\Model\Product">
    <plugin name="change_product" type=" Vendor\Module\Plugin\Product" sortOrder="1" />

Create file /Vendor/Module/Plugin/Product.php and copy below code:


namespace Vendor\Module\Plugin;

    class Product
        public function afterGetPrice(\Magento\Catalog\Model\Product $subject, $result)
            return round($result);

please use this plugin. This is Best solution and tested in 2.3 and working fine.



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.