Skip to content

Commit

Permalink
19482-Increase-product-quantity-with-disabled-Manage-Stock-when-place…
Browse files Browse the repository at this point in the history
…-order-is-failed

Increase product quantity with disabled Manage Stock when place order is failed #19482
  • Loading branch information
Oleksii Gorbulin committed Dec 27, 2018
1 parent c608b02 commit 1a5a6be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/code/Magento/CatalogInventory/Model/StockManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ public function registerProductsSale($items, $websiteId = null)

/**
* @param string[] $items
* @param int $websiteId
* @return bool
* @param int|null $websiteId
*
* @return array|bool
*/
public function revertProductsSale($items, $websiteId = null)
{
Expand All @@ -161,7 +162,7 @@ public function revertProductsSale($items, $websiteId = null)
}
$this->qtyCounter->correctItemsQty($revertItems, $websiteId, '+');

return true;
return $revertItems;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function execute(EventObserver $observer)
{
$quote = $observer->getEvent()->getQuote();
$items = $this->productQty->getProductQty($quote->getAllItems());
$this->stockManagement->revertProductsSale($items, $quote->getStore()->getWebsiteId());
$productIds = array_keys($items);
$revertedItems = $this->stockManagement->revertProductsSale($items, $quote->getStore()->getWebsiteId());
$productIds = array_keys($revertedItems);
if (!empty($productIds)) {
$this->stockIndexerProcessor->reindexList($productIds);
$this->priceIndexer->reindexList($productIds);
Expand Down

0 comments on commit 1a5a6be

Please sign in to comment.