Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 1a5a6be

Browse files
author
Oleksii Gorbulin
committed
19482-Increase-product-quantity-with-disabled-Manage-Stock-when-place-order-is-failed
Increase product quantity with disabled Manage Stock when place order is failed #19482
1 parent c608b02 commit 1a5a6be

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/code/Magento/CatalogInventory/Model/StockManagement.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ public function registerProductsSale($items, $websiteId = null)
142142

143143
/**
144144
* @param string[] $items
145-
* @param int $websiteId
146-
* @return bool
145+
* @param int|null $websiteId
146+
*
147+
* @return array|bool
147148
*/
148149
public function revertProductsSale($items, $websiteId = null)
149150
{
@@ -161,7 +162,7 @@ public function revertProductsSale($items, $websiteId = null)
161162
}
162163
$this->qtyCounter->correctItemsQty($revertItems, $websiteId, '+');
163164

164-
return true;
165+
return $revertItems;
165166
}
166167

167168
/**

app/code/Magento/CatalogInventory/Observer/RevertQuoteInventoryObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function execute(EventObserver $observer)
6464
{
6565
$quote = $observer->getEvent()->getQuote();
6666
$items = $this->productQty->getProductQty($quote->getAllItems());
67-
$this->stockManagement->revertProductsSale($items, $quote->getStore()->getWebsiteId());
68-
$productIds = array_keys($items);
67+
$revertedItems = $this->stockManagement->revertProductsSale($items, $quote->getStore()->getWebsiteId());
68+
$productIds = array_keys($revertedItems);
6969
if (!empty($productIds)) {
7070
$this->stockIndexerProcessor->reindexList($productIds);
7171
$this->priceIndexer->reindexList($productIds);

0 commit comments

Comments
 (0)