Skip to main content

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!

Hi Florian,
Do the add-ons potentially have inventory and discounts?
 


Hi Florian,
Do the add-ons potentially have inventory and discounts?
 

Hey! Yes, they do. They have pictures, pricing, inventory and also potentially discounts (while that is not super important).


I assume when you remove the main dish, all addons should also be removed?



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.

You can have the SKU in multiple lines if they have a different custom field for example.
What I see often is a custom field called GroupID that links the addons to the Dish


I assume when you remove the main dish, all addons should also be removed?



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.

You can have the SKU in multiple lines if they have a different custom field for example.
What I see often is a custom field called GroupID that links the addons to the Dish

Ah, I did not know that! Will give that a try.

 

Removing the main dish does not necessarily have to trigger removing addons as we are controlling that through custom code anyway.


Reply