My understanding of Grouped Products is a little limited, but as I understand it, a Grouped Product is simply a listing of products that I want to show to customers on one page.
If one or more items are added to the cart from that Grouped Product, they are added as individual line items.
Why then, would I not be able to add ANY individual line items to my cart from a Grouped Product page if ANY of the listed products are out of stock?
Example: a Grouped Product with 20 individual products listed on the page – one of those listed items is out of stock. This means I am unable to add any item on that page to the cart, with the message "This product is out of stock." displayed if I try.
If I add the out of stock product into stock and then try the same process again, I can add items to the cart just fine.
Is this another bug in Magento 2.1?
Anyone know of a fix, if so?
Best Answer
I ended up just manipulating the grouped product template, it seems that the qty fields are all passed as an array, and as the "out of stock" items have no input field or value they throw a validation error.
I just added my own
grouped.phtml
in/app/design/frontend/<Vendor>/<Theme>/Magento_GroupedProduct/templates/product/view/type
and copied the entire phtml file from the Magento core, with just the addition of a hidden field in the out of stock condition:Hopefully it'll help in some way, I'm sure it'll be fixed in 2.3.0 but this worked for me until then.