Skip Navigation

[Resolved] how to retrieve post relationship after converting CPT to woocommerce product

This support ticket is created 2 years, 6 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 2 replies, has 2 voices.

Last updated by Rajiv Kumar 2 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2203045

Hello Team, I have a custom post type "Livre" and I want to convert this post type to woocommerce Product type. As a test I converted one custom post to product and I found that all post relationship is gone. Can anyone help me to find solution that post relationship can be retrieved after changing post type. Any help will be greatly appreciated.

#2204429

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

screenshot-b.png
screenshot-a.png

Hi,

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

In Toolset, for every post-relationship that you add at WP Admin -> Toolset -> Relationships, a unique 'id' is assigned to it, in the "{table_prefix}_toolset_relationships" table.

For example, "screenshot-a", shows this table, where the relationship between Posts and Pages is '1' and between Books and Pages is '2'

Whenever a relationship connection is formed between two posts, their post ID is saved in another table "{table_prefix}_toolset_connected_elements" in the "element_id" column, and the unique 'id' from this table is used in the table "{table_prefix}_toolset_associations", to store the actual relationship information between two posts.

This means that to retain the relationship connection after converting the post type, you'll also have to replace the "relationship_id" in the "{table_prefix}_toolset_associations" table from the old relationship to the new one.
( example screenshot-b )

If this database level modification seems too complicated, an alternative can be to first export the existing "Livre" posts and their related post data in a CSV file and then import them, as a "Product" post. We have a guide on the topic at:
https://toolset.com/course-lesson/how-to-import-content-into-wordpress-using-csv/

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

regards,
Waqar

#2207129

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.