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(
195
195
//TODO Seems \Magento\Quote\Model\Quote\Item\AbstractItem::getDiscountPercent() returns float value
196
196
//that can not be used as array index
197
197
$ percentKey = $ item ->getDiscountPercent ();
198
- if ($ percentKey ) {
198
+ $ rowTotal = $ item ->getRowTotal ();
199
+ if ($ percentKey && $ rowTotal > 0 ) {
199
200
$ delta = isset ($ this ->_roundingDeltas [$ percentKey ]) ? $ this ->_roundingDeltas [$ percentKey ] : 0 ;
200
201
$ baseDelta = isset ($ this ->_baseRoundingDeltas [$ percentKey ]) ? $ this ->_baseRoundingDeltas [$ percentKey ] : 0 ;
201
202
Original file line number Diff line number Diff line change @@ -463,6 +463,7 @@ public function testDeltaRoundignFix()
463
463
$ discountAmount = 10.003 ;
464
464
$ baseDiscountAmount = 12.465 ;
465
465
$ percent = 15 ;
466
+ $ rowTotal = 100 ;
466
467
$ roundedDiscount = round ($ discountAmount , 2 );
467
468
$ roundedBaseDiscount = round ($ baseDiscountAmount , 2 );
468
469
$ delta = $ discountAmount - $ roundedDiscount ;
@@ -491,6 +492,7 @@ public function testDeltaRoundignFix()
491
492
->willReturn ($ store );
492
493
493
494
$ this ->item ->setDiscountPercent ($ percent );
495
+ $ this ->item ->setRowTotal ($ rowTotal );
494
496
495
497
$ discountData = $ this ->createMock (Data::class);
496
498
$ discountData ->expects ($ this ->at (0 ))
@@ -523,7 +525,6 @@ public function testDeltaRoundignFix()
523
525
524
526
$ this ->assertEquals ($ this ->utility , $ this ->utility ->deltaRoundingFix ($ discountData , $ this ->item ));
525
527
$ this ->assertEquals ($ this ->utility , $ this ->utility ->deltaRoundingFix ($ discountData , $ this ->item ));
526
-
527
528
}
528
529
529
530
public function testResetRoundingDeltas ()
You can’t perform that action at this time.
0 commit comments