-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Magento 2.2.2 version stock status(Quantity) attribute(quantity_and_stock_status) is not updating in catalog product admin grid #15201
Comments
Hello @vijaymagento1, thank you for your report. |
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: `
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? |
@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 But if you still run into this problem please update or provide additional information/steps/preconditions in the Description section and reopen this issue. |
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! |
@vteofilo you can help me to apply this code? |
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.
Preconditions
Magento 2.2.2
Steps to reproduce
Screenshot:- https://i.imgur.com/bgqrgbK.png
Screenshot:- https://i.imgur.com/Rxbi1GC.png
Expected result
"Stock status" has correct value.
Actual result
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!
The text was updated successfully, but these errors were encountered: