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.
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
My issue is resolved now. Thank you!