File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
app/code/Magento/SalesRule Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,8 @@ public function deltaRoundingFix(
195195 //TODO Seems \Magento\Quote\Model\Quote\Item\AbstractItem::getDiscountPercent() returns float value
196196 //that can not be used as array index
197197 $ percentKey = $ item ->getDiscountPercent ();
198- if ($ percentKey ) {
198+ $ rowTotal = $ item ->getRowTotal ();
199+ if ($ percentKey && $ rowTotal > 0 ) {
199200 $ delta = isset ($ this ->_roundingDeltas [$ percentKey ]) ? $ this ->_roundingDeltas [$ percentKey ] : 0 ;
200201 $ baseDelta = isset ($ this ->_baseRoundingDeltas [$ percentKey ]) ? $ this ->_baseRoundingDeltas [$ percentKey ] : 0 ;
201202
Original file line number Diff line number Diff line change @@ -463,6 +463,7 @@ public function testDeltaRoundignFix()
463463 $ discountAmount = 10.003 ;
464464 $ baseDiscountAmount = 12.465 ;
465465 $ percent = 15 ;
466+ $ rowTotal = 100 ;
466467 $ roundedDiscount = round ($ discountAmount , 2 );
467468 $ roundedBaseDiscount = round ($ baseDiscountAmount , 2 );
468469 $ delta = $ discountAmount - $ roundedDiscount ;
@@ -491,6 +492,7 @@ public function testDeltaRoundignFix()
491492 ->willReturn ($ store );
492493
493494 $ this ->item ->setDiscountPercent ($ percent );
495+ $ this ->item ->setRowTotal ($ rowTotal );
494496
495497 $ discountData = $ this ->createMock (Data::class);
496498 $ discountData ->expects ($ this ->at (0 ))
@@ -523,7 +525,6 @@ public function testDeltaRoundignFix()
523525
524526 $ this ->assertEquals ($ this ->utility , $ this ->utility ->deltaRoundingFix ($ discountData , $ this ->item ));
525527 $ this ->assertEquals ($ this ->utility , $ this ->utility ->deltaRoundingFix ($ discountData , $ this ->item ));
526-
527528 }
528529
529530 public function testResetRoundingDeltas ()
You can’t perform that action at this time.
0 commit comments