I have a specific use case for a customer and I don’t know if Commerce support this feature.
My customer is a food truck and it’s selling classical products with also bundled menu : a set of products sorted on 3 categories : main dish + drink + dessert
The final price, for this bundled menu, depend of the selected main dish.
Here a mockup of the front-end for visitor (right side) :
There’s no out-of-the-box solution in Commerce right now that lets you essentially configure a configurator like that. There are bundle products, but the contents of those are configured by the shop owner; not the customer.
If you only had 2 “variables”, you could use a product matrix which automatically creates a product for each unique combination, but it looks like you need more variables than that.
What you would probably need to do is add a product list tv for each “step” (“Bo bun”, “Nems”, “Boissons”, “Desserts”), that will allow the shop owner to add those products and the price for each. (If you wanted, you could also fetch the products from a central “Drinks” resource if those options are the same for all menus.)
Then you need a custom add-to-cart snippet that takes in a POST request with the selected product IDs, calculates the final price/bundled menu name/etc, and adds it to the cart programmatically. That post has some more details about the different ways you could do that. I’d probably recommend option 2 where you base the order item off your main dish, and then adjust the name/pricing/additional details to match the rest of the selection.
If only the main dish affects the price, another approach which requires no code would involve the ItemData module. The product that would be added to the cart is the main dish, and the other selections would be added as basically key => value pairs of information. Simple to implement, but with some restrictions on what it can do unlike the more custom approach.
Thanks for your kick answer (very appreciable !!!)
I think your last suggestion will do the job, because only the main dish affect the final price of the bundle.
I will dig on this way
I have an issue to get item data on the items.twig template from a select list on the product page.
The MODX generated code for the add to cart form is the following :
I had enable ItemDAta Module but I didn"t understood that I had to add my field to the allowed fields inside the module !
It’s done now, and - obviously - it’s working now
Thanks