Let me put the code that I have tried so far.
Basically, I am trying to capture payments when they are successful by creating a function in the function.php file, the code is provided below.
add_action('woocommerce_payment_complete', 'capture_donation_for_custom_donation_view', 10, 1);
function capture_donation_for_custom_donation_view($order_id){
if ( ! $order_id ) {
return;
}
global $product;
$order = wc_get_order( $order_id );
This function captures the data from the order object and works fine for normal orders. But I am using a plugin WP Crowdfunding to create some crowdfunding projects and data is not being captured through payment hooks.