magento2: Multisource Inventory, can't ship items when using default Stocks

Preconditions (*)

  1. Magento 2.3
  2. Multisource inventory setup to use default stock

Steps to reproduce (*)

  1. Create a simple product with Qty 1
  2. Complete checkout process with that product
  3. Go to admin panel: try to create shipment for that order

Expected result (*)

  1. Shipment should be created, no errors

Actual result (*)

  1. Error: Not all of your products are available in the requested quantity.

I’ve debugged this to be an issue with vendor/magento/module-inventory-source-deduction-api/Model/SourceDeductionService.php class and it’s execute method When multiple source inventory module uses defalts stock, it should not check stock of any sources. I personally think that entire Source Selection / Deduction should be removed from module logic when default stock is being used.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 26 (8 by maintainers)

Most upvoted comments

How is this closed?

For me it was resolved after i added this patch:

diff --git a/vendor/magento/module-inventory-source-deduction-api/Model/SourceDeductionService.php b/vendor/magento/module-inventory-source-deduction-api/Model/SourceDeductionService.php
--- a/vendor/magento/module-inventory-source-deduction-api/Model/SourceDeductionService.php	
+++ b/vendor/magento/module-inventory-source-deduction-api/Model/SourceDeductionService.php	(date 1637674330116)
@@ -85,7 +85,7 @@
             }
 
             $sourceItem = $this->getSourceItemBySourceCodeAndSku->execute($sourceCode, $itemSku);
-            if (($sourceItem->getQuantity() - $qty) >= 0) {
+            if (($sourceItem->getQuantity() - $qty) >= 0 || $stockItemConfiguration->getBackorders()) {
                 $sourceItem->setQuantity($sourceItem->getQuantity() - $qty);
                 $stockStatus = $this->getSourceStockStatus(
                     $stockItemConfiguration,

I have this same issue and I am using core vanilla 2.3 code. I have a product configured with quantity 19 and an order placed for 59 units. When creating shipment in the admin UI, I receive the error “Not all of your products are available in the requested quantity.”. This error is coming from module-inventory-source-deduction-api/Model/SourceDeductionService.php.

        $sourceItem = $this->getSourceItemBySourceCodeAndSku->execute($sourceCode, $itemSku);
        if (($sourceItem->getQuantity() - $qty) >= 0) {
            $sourceItem->setQuantity($sourceItem->getQuantity() - $qty);
            $sourceItems[] = $sourceItem;
        } else {
            throw new LocalizedException(
                __('Not all of your products are available in the requested quantity.')
            );
        }

The admin panel allows you to configure sell below 0, however the code above has no check or concern about this setting which is significantly different behavior than 1x. IMO the designed behavior is not explained and conflicts with how the product can be configured in the admin panel. Can someone from the core team please explain if this is expected behavior why it is allowed to configure to sell below 0 but yet prevent creation of shipment.

I’m having same problem as istoutjesdijk is there a work around?

I have the same problem, we have linked Magento to another system managing our stock and shipments. When an order is placed the stock is changed by this system from 1 to 0 and when stock is 0 it’s not possible to create a shipment in Magento 2.3. Is there a workaround for this issue?