Many to many to one, possible?

I have no idea what this setup is called, but I do have a visualization of what I’m trying to do. :innocent: (see below)

Each product has single attributes like SKU, name, category etc. The ingredients consists of two parts (actually three, but to keep it simple two parts): the ingredient name (which I want to have stored centrally in a table) and the amount.

I this setup possible? And if so, how? Oh and crucial, I would like to export the data to excel so I can import it via WP All Import to ACF.

Many thanks in advance! :smiley:

Hi @Dagaloni

We support following relation types:

  • many to many
  • has many (=many to one)
  • one to one
  • belongs to (=one to many)

You can find detailed information on how to create them on our documentation.

Also we have a video on relations which uses a related sample (Product - Details - Orders..) make sure to check it out on youtube.

For your use case (if I understand it correct) you need to create following relations between tables:

  • Product Ingredients → Products (Has many)
  • Product Ingredients → Ingredients (Has many)

Note that corresponding one to many relations (belongs to) will be automatically created.

Hi @mertmit
Thank you! It got it working like you described. At first I stumbled upon some bugs when enabling the many-2-many system table, but it looks like they are fixed in the newest version, thank you!

However, I encountered a problem for me in the way it is exported to excel. In the table below you can see that Product A and Product B are linked to Vitamin A.

When I export it to excel I get the number of products (ā€œ2ā€ in this example), instead of the actual names.

I wanted to create an excel file I could use to import in to my website to create these links.

For now it is a little too difficult for me to figure out how to do that semi-automatically via an import. If others want to achieve something similar, hopefully this thread helps!

Hi Dagaloni,
For this you can make use of Lookup field.

This way you can visualize any nested field from linked table. Which will be available on export as well.

Oh that is great, thank you!

1 Like