wp-posts-to-posts icon indicating copy to clipboard operation
wp-posts-to-posts copied to clipboard

Payment_complete not working with p2p

Open prodes opened this issue 9 years ago • 1 comments

Hi,

I want to get all connected posts during a woocommerce_payment_complete but I keep getting this message: 'Call to a member function get_connected() on boolean' or 'Can't determine direction for 'multiple_authors' type'. It seems like the payment_complete fires before the p2p_init hook.

Does anyone have any solutions for this?

prodes avatar Nov 23 '15 16:11 prodes

$connected = $wpdb->get_var( $wpdb->prepare( " SELECT p2p_from FROM $wpdb->p2p WHERE p2p_type=%s AND p2p_to=%d ", 'your_connection_type', $post_id ) );

dchichizola avatar Mar 31 '17 10:03 dchichizola