1

Want to show a simple product price in the following way on the product list and detail page.

  1. Magento price: 5623.50 With TAX( 10% ) it’s displayed in the front end as : 5623.50 + 562.35 = 6185.85
  2. we will take the decimal value part (0.85)
  3. Then 1 minus the decimal part 1 - 0.85 = 0.15
  4. Price including TAX + 0.15 = 6185.85 + 0.15 = 6186.00
  5. Customer will pay 6186.00

Till now used afterGetPrice plugin method.

namespace Pr\Ro\Plugin;

use Magento\Catalog\Api\Data\ProductInterface;

class Product
{

    public function afterGetPrice( ProductInterface $subject, $result ) {
        return calculateLogiceMagentoPrice($result);
        //return $result;
    }

    public function calculateLogiceMagentoPrice( $price )
    {       
        $whole = floor($price);         
        $fraction = $price - $whole;
        $minus_decimal = 1 - $fraction;     
        $finalPrice = $price + $minus_decimal;              
        return $finalPrice;
    }   

}

tried with "Magento_Catalog/js/price-utils" and 'PriceModifiers' also

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.