Skip Navigation

[Resolved] Relationships between products (Product to Products)

This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 5 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1183166

Tell us what you are trying to do?
I am trying to setup parent/child relationships between WooCommerce products. (Biological Family Tree)

On the FRONTEND, I want my users to be able to add a new product, within the add product form I need:
1) A custom product field to select father of product (select from existing products or add new product)
2) A custom product field to select mother of product (select from existing products or add new product)

On the product page I would like to automatically display:
Product Father & Father feature image (With link to father's product page)
Product Grandfather & Grandfather feature image (With link to grandfather's product page)
Product Grandmother & Grandmother feature image (With link to grandmother's product page)
ect.

On the Father's product page, I would like to automatically display:
Progeny & Progeny feature image (With link to the original product page)

Is there any documentation that you are following?
I have read these items in documentation, but all of the relationships in toolset are between different Post Types.

***How do I setup relationships between products of the same post type?***

https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
https://toolset.com/documentation/user-guides/using-toolset-with-elementor-page-builder/connect-different-post-types-using-relationships/
https://toolset.com/2018/07/how-to-create-post-relationships-between-your-custom-post-types-and-how-to-display-them/

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1183541

Hi Nick,

Thank you for contacting us and I'll be happy to assist.

As explained in our documentation ( ref: https://toolset.com/documentation/post-relationships/ ), post relationships can be set only between two different post types.

The WooCommerce products are not hierarchal by default, but you can use custom fields for setting up parent/child relationships:

1. You'll add three "Select" type custom fields for the product posts:
( ref: https://toolset.com/documentation/user-guides/using-custom-fields/#how-to-add-custom-fields-to-content

a). Gender: Possible values to select from - "Male" or "Female".

b). Father: Leave the select options empty, as they can be generated dynamically.

c). Mother: Leave the select options empty, as they can be generated dynamically.

2. Next, you can use "wpt_field_options" filter to dynamically generate the select options for the "Father" and "Mother" fields, so that for the father field, all products with "Gender" set as "Male" and for mother all products with "Gender" set as "Female" are shown.

Following are some threads, showing examples of how to use "wpt_field_options" filter:
https://toolset.com/forums/topic/how-to-replace-a-cred-form-select-input-field-with-a-php-snippet/
https://toolset.com/forums/topic/populate-select-field-with-list-of-posts-in-a-custom-post-type-only-showing-5/

Note: this dynamically generated list will be available on the product edit screen in the admin area as well as on the Frontend CRED Form.

3. Once, each product will have the correct product ID stored in the custom field for the father and mother fields, you'll be able to show information from the connected products through either View or through custom code.

https://toolset.com/documentation/getting-started-with-toolset/create-and-display-custom-lists-of-content/
https://toolset.com/documentation/adding-custom-code/how-to-create-a-custom-shortcode/

I hope this helps and please let me know if you need any further assistance around these points.

regards,
Waqar

#1184357

Waqar,

Thank you for your reply. I would like a refund for my purchase of Toolset. I purchased toolset plugins for the complete management of relationships (Product to Product) without any coding! Prior to purchase I assumed that relationships could be created between posts of the same post type (Product to Product), I was wrong.

Please refund my payment, I have already uninstalled all of the toolset plugins from my site.

Thank you,
Nick Sarbacker

#1184833

Hi Nick,

Sorry to learn that the Toolset didn't turn out as expected.

Although "Product-to-Product" relationship is not yet natively supported, the workaround that was suggested in my earlier message can be used to achieve the same. If you find any specific step unclear, I'll be happy to further elaborate on that.

If you'd still like to proceed with the refund, you can submit the form at:
https://toolset.com/buy/refund-policy/

regards,
Waqar