Tell us what you are trying to do?
I need a many-to-many relationship between a custom post type "PartyBox" and a Woocommerce order placed on the session. I have already created the relationship.
Users enter the site via a QR Code on the PartyBox content template. I can grab the Id of the PartyBox (post type) at that time as it needs to be used for creating the relationship with the Woocommerce order. The id of the woocommerce order isn't available until after the order has been created. I'm using woocommerce_order_status_completed hook and then attempting to create the relationship with toolset_connect_posts( 'partybox-order', $box_id, $order_id );.
How can I get the PartyBox post type id to use when order is created? Have tried global variables and cookies and still having issues getting the box_id at the time the order is created. Thank you for your assistance.
Is there any documentation that you are following? Many posts
Is there a similar example that we can see? No
What is the link to your site? On development server only
Hello,
Since it is many-to-many relationship, you can try relationship API function: toolset_get_related_posts()
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
Use the Woocommerce order ID to get related "PartyBox" post IDs.