1

What I am trying to achieve is that, I have SALE on an item I've managed to display the Regular Price and the Special Price But let's say I have a product which has regular price of 319.00 I would like to apply 20% discount on this product which results in a price 255.20. What I want is to round the end number. If the value is below .50 to go to the lower number and if the value is above .50 to go to the bigger number. Is this possible without buying an expensive module. Thanks.

0

I've also gone through this problem, Please use this plugin, I hope this will help you. For Me this is best solution and tested in 2.3 and working fine.

Price Decimal Precision Free Magento 2 Extension

| improve this answer | |
  • Thank you for the suggestion but isn't this plugin just hiding the decimal part of the price? – Serco33 Dec 17 '19 at 19:15
0

I've found a solution for my issue. I am using Magento 2.3.2. Tried this plugin Magento 2 Price Round plugin Everything is working perfect so far.

| improve this answer | |
0

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" 
xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> 
<type name="Magento\Directory\Model\Currency">
    <plugin name="vendor_module" type="Vendor\Module\Model\Plugin\Currency" />
</type>  

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

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

| improve this answer | |

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.