Skip to content

Commit 4052b53

Browse files
#38455: Fixed
- the mistake was that the amount for non-taxes after the discount came with incorrect rounding
1 parent 7d69f6d commit 4052b53

File tree

1 file changed

+6
-6
lines changed
  • app/code/Magento/SalesRule/Model/Rule/Action/Discount

1 file changed

+6
-6
lines changed

app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\SalesRule\Model\Rule\Action\Discount;
77

@@ -60,11 +60,11 @@ protected function _calculate($rule, $item, $qty, $rulePercent)
6060
$baseItemOriginalPrice = $this->validator->getItemBaseOriginalPrice($item);
6161

6262
$_rulePct = $rulePercent / 100;
63-
$discountData->setAmount(($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct);
64-
$discountData->setBaseAmount(($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct);
65-
$discountData->setOriginalAmount(($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct);
63+
$discountData->setAmount($this->priceCurrency->round(($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct));
64+
$discountData->setBaseAmount($this->priceCurrency->round(($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct));
65+
$discountData->setOriginalAmount($this->priceCurrency->round(($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct));
6666
$discountData->setBaseOriginalAmount(
67-
($qty * $baseItemOriginalPrice - $item->getBaseDiscountAmount()) * $_rulePct
67+
$this->priceCurrency->round(($qty * $baseItemOriginalPrice - $item->getBaseDiscountAmount()) * $_rulePct)
6868
);
6969

7070
if (!$rule->getDiscountQty() || $rule->getDiscountQty() >= $qty) {

0 commit comments

Comments
 (0)