Skip to content

Commit d65e7a2

Browse files
committed
Merge remote-tracking branch 'performance-ce/MCP-602' into MCP-584-2
2 parents bb9b442 + 809858a commit d65e7a2

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

app/code/Magento/Quote/Model/Config.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function __construct(ScopeConfigInterface $config)
3535
*/
3636
public function isEnabled(): bool
3737
{
38-
//return (bool)$this->config->getValue(self::XML_PATH_INVENTORY_CHECK_ENABLED);
39-
return false;
38+
return (bool)$this->config->getValue(self::XML_PATH_INVENTORY_CHECK_ENABLED);
4039
}
4140
}

app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,16 @@ public function getStore()
318318
}
319319

320320
/**
321-
* Checking item data
321+
* Set and Validate Item Qty
322322
*
323-
* @return $this
323+
* @return void
324324
*/
325-
public function checkData()
325+
public function setQuantity()
326326
{
327327
$this->setHasError(false);
328328
$this->clearMessage();
329329

330330
$qty = $this->_getData('qty');
331-
332331
try {
333332
$this->setQty($qty);
334333
} catch (\Magento\Framework\Exception\LocalizedException $e) {
@@ -338,7 +337,16 @@ public function checkData()
338337
$this->setHasError(true);
339338
$this->setMessage(__('Item qty declaration error'));
340339
}
340+
}
341341

342+
/**
343+
* Checking item data
344+
*
345+
* @return $this
346+
*/
347+
public function checkData()
348+
{
349+
$this->setQuantity();
342350
try {
343351
$this->getProduct()->getTypeInstance()->checkProductBuyState($this->getProduct());
344352
} catch (\Magento\Framework\Exception\LocalizedException $e) {

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ protected function _assignProducts(): self
293293
$item->setQtyOptions($qtyOptions)->setProduct($product);
294294
if ($this->config->isEnabled()) {
295295
$item->checkData();
296+
} else {
297+
$item->setQuantity();
296298
}
297299
}
298300
}

0 commit comments

Comments
 (0)