Skip to content

Commit 56877be

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-88504: Tiered pricing and quantity Increments do not work with decimal inventory
1 parent 8b32f5e commit 56877be

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

app/code/Magento/CatalogInventory/Model/Stock/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public function getQtyIncrements()
402402
$this->qtyIncrements = $this->stockConfiguration->getQtyIncrements($this->getStoreId());
403403
} else {
404404
$qtyIncrements = $this->getData(static::QTY_INCREMENTS);
405-
$this->qtyIncrements = ($this->getIsQtyDecimal() ? (float) $qtyIncrements : (int) $qtyIncrements);
405+
$this->qtyIncrements = $this->getIsQtyDecimal() ? (float) $qtyIncrements : (int) $qtyIncrements;
406406
}
407407
}
408408
if ($this->qtyIncrements <= 0) {

app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ public function testGetQtyIncrements($config, $expected)
394394
$this->setDataArrayValue('qty_increments', $config['qty_increments']);
395395
$this->setDataArrayValue('enable_qty_increments', $config['enable_qty_increments']);
396396
$this->setDataArrayValue('use_config_qty_increments', $config['use_config_qty_increments']);
397+
$this->setDataArrayValue('is_qty_decimal', $config['is_qty_decimal']);
397398
if ($config['use_config_qty_increments']) {
398399
$this->stockConfiguration->expects($this->once())
399400
->method('getQtyIncrements')
@@ -415,26 +416,38 @@ public function getQtyIncrementsDataProvider()
415416
[
416417
'qty_increments' => 1,
417418
'enable_qty_increments' => true,
418-
'use_config_qty_increments' => true
419+
'use_config_qty_increments' => true,
420+
'is_qty_decimal' => false
419421
],
420422
1
421423
],
422424
[
423425
[
424426
'qty_increments' => -2,
425427
'enable_qty_increments' => true,
426-
'use_config_qty_increments' => true
428+
'use_config_qty_increments' => true,
429+
'is_qty_decimal' => false
427430
],
428431
false
429432
],
430433
[
431434
[
432435
'qty_increments' => 3,
433436
'enable_qty_increments' => true,
434-
'use_config_qty_increments' => false
437+
'use_config_qty_increments' => false,
438+
'is_qty_decimal' => false
435439
],
436440
3
437441
],
442+
[
443+
[
444+
'qty_increments' => 0.5,
445+
'enable_qty_increments' => true,
446+
'use_config_qty_increments' => false,
447+
'is_qty_decimal' => true
448+
],
449+
0.5
450+
],
438451
];
439452
}
440453

0 commit comments

Comments
 (0)