Skip to content

Commit 1cbe272

Browse files
committed
Merge remote-tracking branch 'origin/MC-41356' into 2.4.3-develop-pr132
2 parents d6d1453 + 6632d70 commit 1cbe272

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function validate(Observer $observer)
185185
* Check item for options
186186
*/
187187
if ($options) {
188-
$qty = $product->getTypeInstance()->prepareQuoteItemQty($qty, $product);
188+
$qty = $product->getTypeInstance()->prepareQuoteItemQty($quoteItem->getQty(), $product);
189189
$quoteItem->setData('qty', $qty);
190190
if ($stockStatus) {
191191
$this->checkOptionsQtyIncrements($quoteItem, $options);

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function initialize(
120120
/**
121121
* if option's qty was updates we also need to update quote item qty
122122
*/
123-
$quoteItem->setData('qty', (int) $qty);
123+
$quoteItem->setData('qty', (int) $result->getItemQty());
124124
}
125125
if ($result->getMessage() !== null) {
126126
$option->setMessage($result->getMessage());

app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function setUp(): void
125125
);
126126
$this->resultMock = $this->getMockBuilder(DataObject::class)
127127
->addMethods(
128-
['getItemIsQtyDecimal', 'getHasQtyOptionUpdate', 'getOrigQty', 'getMessage', 'getItemBackorders']
128+
['getItemIsQtyDecimal', 'getHasQtyOptionUpdate', 'getOrigQty', 'getMessage', 'getItemBackorders', 'getItemQty']
129129
)
130130
->disableOriginalConstructor()
131131
->getMock();
@@ -217,6 +217,7 @@ public function testInitializeWhenResultIsDecimalGetBackordersMessageHasOptionQt
217217
$this->optionMock->expects($this->once())->method('setBackorders')->with('backorders');
218218

219219
$this->stockItemMock->expects($this->once())->method('unsIsChildItem');
220+
$this->resultMock->expects($this->once())->method('getItemQty')->willReturn($qty);
220221
$this->validator->initialize($this->optionMock, $this->quoteItemMock, $qty);
221222
}
222223

app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ private function createInitialStub($qty)
564564
$this->quoteItemMock->expects($this->any())
565565
->method('getQuote')
566566
->willReturn($this->quoteMock);
567-
$this->quoteItemMock->expects($this->once())
567+
$this->quoteItemMock->expects($this->any())
568568
->method('getQty')
569569
->willReturn($qty);
570570
$this->quoteItemMock->expects($this->any())

0 commit comments

Comments
 (0)