Hi Magento2 Support tean,
I have added product attribute(quantity_and_stock_status) column in catalog product admin grid for the filtering the "In Stock" and "Out of Stock" products list.
Magento 2.2.2
"Stock status" has correct value.
Product not updating stock status in catalog product admin grid it always shows "In Stock" status.
Screenshot:- https://i.imgur.com/wT5Kl2i.png
Please solve this issues as soon as possible. This issues is also persist in magento Latest version(2.2.4).
Thanks!
Same problem in magneto 2.2.4
Please Check below screen shot.


Please help me how to resolve this problem.
Hello @vijaymagento1, thank you for your report.
We've acknowledged the issue and added to our backlog.
Exact same issue here. Hopefully Magento (Adobe) will fix this soon.
Also, the stock status column should not be labeled "Quantity".
This worked for me:
As I have a specific function to update inventory that extends \Magento\CatalogInventory\Model\StockRegistry, I called inside it, but if you use Magento itself you should create a plugin to be called after you have run the function Magento\CatalogInventory\Model\StockRegistry::updateStockItemBySku(). At each inventory update, this function updates the is_in_stock status of the parent product by adding the items of the child products:
`
public function syncProductStock(int $productId)
{
$product = $this->productFactory->create();
$product->load($productId);
$productParent= $this->productFactory->create();
$productParent->load(
$this->objectManager->get(\Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable::class)
->getParentIdsByChild($productId)
);
$childrenIds = array_values(
$this->objectManager->get(\Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable::class)
->getChildrenIds($productParent->getId())[0]
);
$sumQuantity = 0;
foreach ($childrenIds as $childrenId) {
$sumQuantity += $this->objectManager->get(\Magento\CatalogInventory\Model\StockRegistry::class)
->getStockItem($childrenId)->getQty();
}
$isInStock = $sumQuantity > 0 ? 1 : 0;
$product->addAttributeUpdate('quantity_and_stock_status', $this->getStockItem($productId)->getIsInStock(), $product->getStoreId());
$productParent->addAttributeUpdate('quantity_and_stock_status', $isInStock, $product->getStoreId());
$parentStockItem = $this->getStockItem($productParent->getId());
$parentStockItem->setIsInStock($isInStock);
$this->stockItemRepository->save($parentStockItem);
}`
The fix loads the product by productId, loads its parent, and takes the ids of all its children to the sum of each one's stock. Through the stock sum of the children products, 1 or 0 is assigned to the quantity_and_stock_status attribute of the child products and the parent product. Finally, it points to the IsInStock of the StockItemRepository according to the same sum and saves the parent stock.
Hope this helps! Thank you!
@vteofilo Thank you! Your fix solved my issues.
@vteofilo please explain bit more how to use your fix to solve this issue?
@vteofilo please explain bit more how to use your fix to solve this issue?
@Puru2016 , yes of course! The fix loads the product by productId, loads its parent, and takes the ids of all its children to the sum of each one's stock. Through the stock sum of the children products, 1 or 0 is assigned to the _quantity_and_stock_status_ attribute of the child products and the parent product. Finally, it points to the _IsInStock_ of the _StockItemRepository_ according to the same sum and saves the parent stock.
Hi @vijaymagento1.
Thank you for your report and collaboration!
The related internal Jira ticket MC-19978 was closed as non-reproducible in 2.3-develop.
It means that Magento team either unable to reproduce this issue using provided _Steps to Reproduce_ from the _Description section_ on clean Magento instance or the issue has been already fixed in the scope of other tasks.
But if you still run into this problem please update or provide additional information/steps/preconditions in the _Description section_ and reopen this issue.
Hi Magento2 Support team,
Do we have a patch for this available, we are on 2.3.1 and the issue still persists as you can see in the screenshots:


Same issue on 2.2.7 is possible that Magento team is not taking care of an issue such stupid and important at the same time?
I need to filter all items that have qty>1 in "out of stock" status, no solution! Absolutely absurd!