Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Getting order details in WooCommerce action hook

$
0
0

Replies: 0

I have made a custom function which is sending revenue data to tracking tool when subscription payment is successful.

The problem I have is that I don’t know how to obtain order details, and user email inside the hook function.

Here is my function (functions.php);

add_action('woocommerce_subscription_payment_complete','mixpanel_revenue_tracking', 10, 1);
function mixpanel_revenue_tracking($subscription) {
   // need to collect that data here
   $subscriptionName = ;
   $ordertotal = ;
   $userEmail = ;
}

Any ideas? Tried that code but its not working :

$email = $subscription ->billing_email;
 $total = $subscription->get_total();
  • This topic was modified 8 minutes ago by  Marcinf2.
  • This topic was modified 6 minutes ago by  Marcinf2. Reason: bad spacing

Viewing all articles
Browse latest Browse all 59525

Trending Articles