Magento2: Multi stock fail - Order item is not decreasing stock product

Created on 6 Feb 2017  路  5Comments  路  Source: magento/magento2

Preconditions

  1. PHP 7
  2. Magento dev branch

Steps to reproduce

  1. Create multiple websites and stores.
  2. Change the stock of a product and press save.
  3. Place an order with the same product on one of the websites different from the default.

Expected result

  1. Decreasing stock in a product, after successful order.

Actual result

  1. Same stock as before placing a successful order

Analyse

  1. Product has only one stock item with the website_id 2
    screen shot 2017-02-06 at 10 58 37

  2. The website we placed order in is website_id 3

  3. The stock managment in the file httpdocs/vendor/magento/module-catalog-inventory/Model/StockManagement.php::registerProductsSale

The line:
$websiteId = $this->stockConfiguration->getDefaultScopeId();
Gets the current website id.

screen shot 2017-02-06 at 11 04 03

  1. So we have a mismatch between the website_id's causing a failure in stock decrease.
Cannot Reproduce Format is valid needs update bug report

All 5 comments

Hi @basselalaraaj ,

See my response for similar question.

@maghamed @naydav
i dont want to use multi stock.
i want to use single stock, with multiple websites.
But there is a bug when u have multiple websites and u are using single stock.
So it is not similar to the question you responsed to.

  • i create a product with single stock that is visible in the website .com and .org.
  • if someone buys it in .com, the qty decreases
  • but if someone else buys it .org, the qty does not decrease
    so thats it a bug.

Hi, @basselalaraaj. We need more information about your configurations, exact Magento version you use and steps to reproduce this issue. On 2.2.0 and 2.1.7 I didn't observed this behavior.

@basselalaraaj we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

This is coming from Magento core where their last change is left unfinished in 2016

MAGETWO-48153 reverted MAGETWO-46688 changes and left just websiteId's commented out so forcing you to use websiteId = 0.

Was this page helpful?
0 / 5 - 0 ratings