I have been looking at bundled and grouped products but I don't think they provide me with a solution to what I am trying to achieve.
I have 3 products, for example:
1 x apple
1 x pear
1 x orange
If I wanted to create a fruit basket containing 1 of each how would I go about it?
At this point I don't want a customer to be able to pick and choose which bits they do or don't want, almost like this item is a product in its own right, but with stock powered from each product. So that if I run out of apples I don't sell any packages.
Thanks in advance
Solved! Go to Solution.
You cannot achieve such functionality out-of-the-box.
In order to be able to do such thing, you should create Grouped product with three simple products (Apple, Pear, Orange) associated to it. Also, you have to configure those simple products to "Not visible individually" in order to restrict Customer to add them separately.
Now, custom code changes. You have to implement two things:
1. Hide QTY text boxes for those simple items depending on custom attribute value (you can create attribute "Is it a basket"). This should be a simple code change.
2. Add plugin or observer on appropriate add-to-cart event which checks if any of those products falls to zero; in that case, it should automatically set out-of-stock status to the parent product (grouped product).