magento / magento/inventory

Magento 2 MSI not updating the salable Quantity Properly and thus customer can order more product than actual available stock.

Open
#2,727 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

Hi Am facing a Tricky issue on Magneto 2.3.3 Opensource edition .

** Preconditions **

1 Magneto 2.3.3 .
2 Multi Store enabled .
3 Multi inventory enabled.
4 Fresh Magneto installed without any custom plugins .

** Summary **

When an inventory is shared among two or more stores the purchase of a product from the store should update the salable quantity of product among other stores which the inventory is shared .
The issue is as follows (Explained with an example for ease of understanding ) :

I have Two stores on an magneto admin say Store X and Store Y , one for county X and other for country Y .

I have also 2 Separate Inventory (representing my 2 physical warehouse ) Say Inventory-X and Inventory-Y.

The Store X has access to two inventories Inventory-X and Inventory-Y .
Where as .
The Store Y has access only access to Inventory-Y .

Now I have a product Test Which is available on both stores . and on Inventory-X it is of quantity 10 and on Inventory-Y it is of quantity 5 .

That is on Store X salable quantity of product Test is 15 and on Store Y salable quantity of product Test is 5 . It is initially correctly set by Magneto Without any issues.

Now comes our real issue :

Now suppose a customer orders 15 product from Store X Then Magneto updates the salable quantity of Store X with 0 , but not updating the salable quantity of Store Y as 0 , which is logical , and thus this allows another customer to place order 5 product Test from Store Y ,Which has already been sold out through Store X .

**Steps to reproduce**

1 Create Two Stores on am admin Store-1 , Store-1 .
2 Create two different inventories inventory-1 ,inventory-2.
3 Assign stock as follows :- store-1 with inventory-1 and inventory-2 . store-2 with inventory-1 only .
4 Create a product P1 and assign inventory-1 quantity =10 and inventory-2 quantity =5 enble this product for both store-1 and store-2.

5 order 15 products from store-1 .
6 you will also be able to order another 5 product from store-2 , which is not expected.

**Expected result**

After First Customer done the purchase salable quantity of Store-1 and Sore-2 should have been set as zero , thus not allowing any more purchases on both sores .

**Actual result**

Salable Quantity of Store-1 only got updated , Salable quantity of Store-2 remains the same thus allowing 5 more product P1 to be purchased from store-2 .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction steps: configure two stores and inventories, assign the shared product quantities, and place the order from store-1. Compare salable quantities for both stores after the order, then trace the inventory update flow to determine why store-2 remains orderable. Done means both stores report zero salable quantity and reject the additional purchase.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.