Create child table based on different DocType, many to many relationships

Hi, I am creating a custom module, I want to link a Recipe with it’s ingredients and price per ingredient.

Ingredient: has name and price
Recipe - has many → Ingredient

However, Ingredient can’t be a child table as many recipes share the same ingredients, how can I link my doctypes?

Thanks

Your child table should be “Recipe Ingredient”

To follow on Rushabh’s guidance, in the Recipe Ingredient child doctype, you can create a Link field to your base (non-child) Ingredient doctype. That allows you to have properties that apply to either the master doc or the child. For example, your master doc (Ingredient) might define things inherent to the food like calories per gram, while your child doc (Recipe Ingredient) might define things particular to a recipe like quantity and unit of measure.

Thanks a lot Peter, that cleared a lot. I’ll try this and report back.