Skip to content

Instantly share code, notes, and snippets.

@deniscsz
Created October 9, 2020 00:08
Show Gist options
  • Save deniscsz/ee44969d40c54749021ea4f327464651 to your computer and use it in GitHub Desktop.
Save deniscsz/ee44969d40c54749021ea4f327464651 to your computer and use it in GitHub Desktop.
Fixing the error "Not all of your products are available in the requested quantity." when admin try create a shipment with backorder items
From 55dbc56b22f609c1b1a943f71566569f6f7affb0 Mon Sep 17 00:00:00 2001
From: Denis Colli Spalenza <[email protected]>
Date: Thu, 8 Oct 2020 21:01:08 -0300
Subject: [PATCH] Adding support to backorders
---
Model/SourceDeductionService.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Model/SourceDeductionService.php b/Model/SourceDeductionService.php
index 142e569..9458f00 100644
--- a/Model/SourceDeductionService.php
+++ b/Model/SourceDeductionService.php
@@ -73,8 +73,11 @@ class SourceDeductionService implements SourceDeductionServiceInterface
$stockId
);
- if (!$stockItemConfiguration->isManageStock()) {
- //We don't need to Manage Stock
+ $isBackorders = $stockItemConfiguration->getBackorders() == \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NONOTIFY
+ || $stockItemConfiguration->getBackorders() == \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NOTIFY;
+
+ if (!$stockItemConfiguration->isManageStock() || $isBackorders) {
+ //We don't need to Manage Stock or backorder products
continue;
}
--
2.21.1 (Apple Git-122.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment