diff --git a/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/Price/Discount.php b/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/Price/Discount.php index c56e05bf267a4..d738d4387ee7d 100644 --- a/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/Price/Discount.php +++ b/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/Price/Discount.php @@ -72,7 +72,10 @@ private function getPriceDifferenceAsValue(float $regularPrice, float $finalPric */ private function getPriceDifferenceAsPercent(float $regularPrice, float $finalPrice): float { - $difference = $this->getPriceDifferenceAsValue($regularPrice, $finalPrice); + $difference = $regularPrice - $finalPrice; + if ($difference <= $this->zeroThreshold) { + return 0; + } if ($difference <= $this->zeroThreshold || $regularPrice <= $this->zeroThreshold) { return 0; diff --git a/vendor/magento/module-catalog-rule/Model/Indexer/ProductPriceCalculator.php b/vendor/magento/module-catalog-rule/Model/Indexer/ProductPriceCalculator.php index 02b499c75b7e9..828ce80272907 100644 --- a/vendor/magento/module-catalog-rule/Model/Indexer/ProductPriceCalculator.php +++ b/vendor/magento/module-catalog-rule/Model/Indexer/ProductPriceCalculator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\CatalogRule\Model\Indexer; @@ -28,7 +29,7 @@ public function __construct(\Magento\Framework\Pricing\PriceCurrencyInterface $p * Calculates product price. * * @param array $ruleData - * @param null $productData + * @param array|null $productData * @return float */ public function calculate($ruleData, $productData = null) @@ -56,6 +57,6 @@ public function calculate($ruleData, $productData = null) $productPrice = 0; } - return $this->priceCurrency->round($productPrice); + return $this->priceCurrency->roundPrice($productPrice, 4); } } diff --git a/vendor/magento/module-catalog-rule/Pricing/Price/CatalogRulePrice.php b/vendor/magento/module-catalog-rule/Pricing/Price/CatalogRulePrice.php index ec63d70d55abf..2cfd68349fae4 100644 --- a/vendor/magento/module-catalog-rule/Pricing/Price/CatalogRulePrice.php +++ b/vendor/magento/module-catalog-rule/Pricing/Price/CatalogRulePrice.php @@ -18,8 +18,6 @@ use Magento\Store\Model\StoreManagerInterface; /** - * Class CatalogRulePrice - * * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class CatalogRulePrice extends AbstractPrice implements BasePriceProviderInterface @@ -27,7 +25,7 @@ class CatalogRulePrice extends AbstractPrice implements BasePriceProviderInterfa /** * Price type identifier string */ - const PRICE_CODE = 'catalog_rule_price'; + public const PRICE_CODE = 'catalog_rule_price'; /** * @var TimezoneInterface @@ -97,7 +95,7 @@ public function getValue() $this->value = $this->value ? (float)$this->value : false; } if ($this->value) { - $this->value = $this->priceCurrency->convertAndRound($this->value); + $this->value = $this->priceCurrency->convertAndRound($this->value, null, null, 4); } } diff --git a/vendor/magento/module-tax/Model/Calculation/UnitBaseCalculator.php b/vendor/magento/module-tax/Model/Calculation/UnitBaseCalculator.php index 655fcc9749cb3..6a7c9daab6c69 100644 --- a/vendor/magento/module-tax/Model/Calculation/UnitBaseCalculator.php +++ b/vendor/magento/module-tax/Model/Calculation/UnitBaseCalculator.php @@ -1,8 +1,10 @@ config->applyTaxAfterDiscount($this->storeId); - $priceInclTax = $this->calculationTool->round($item->getUnitPrice()); + $priceInclTax = $item->getUnitPrice(); if (!$this->isSameRateAsStore($rate, $storeRate)) { $priceInclTax = $this->calculatePriceInclTax($priceInclTax, $storeRate, $rate, $round); }