Hey there,
I’m currently planning our data model for an upcomig project and was wondering what good approaches to modelling modifiers/addons are.
So requirements are basically this:
- We want to sell a dish that has some base ingredients you cannot take away (i.e. Pasta Bolognese)
- You should be able to choose certain things attached to it (for example pasta type: Spaghetti, Rigatoni etc.)
- You should be able to choose additional items, for example: Extra Cheese, More Sauce, Extra Meatballs, etc. (it’s pretty generic and makes more sense when you think about a bowl for example)
My first thought was to model it with 2 different product types (Dish and Modifier/Addon). You would then add them all the to the cart and the line item would have a custom field to hold the reference to the “main” dish line item. But unfortunately that is not super clean already, but it’s also not allowed to have the same SKU in a cart in multiple line items.
So I could have a big json field in a custom field to hold info about which modifiers belong to which main product, but that seems quite ugly to me. Especially because you could have 1 Bolognese with a certain set of selected modifiers and then another one and you might want to refund just one and so on.
Am I missing something and there’s other ways? I thought about creating variants for all combinations, but that can quickly be a few hundred (if not thousand) variants per product.
Very happy to hear thoughts to that or maybe just a wink into the right direction.
Thanks a lot!