Woocommerce Paypal get current user inside order status completed
-
I’m trying to get the current user email when he completed the order. But the user email is empty and he’s not logged.
Here is my code :
function mysite_woocommerce_order_status_completed( $order_id ) {
$order = new WC_Order( $order_id );
$nb_credit = $order->get_item_count(); // it works
$current_user = wp_get_current_user(); // This is empty
}add_action( ‘woocommerce_order_status_completed’, ‘mysite_woocommerce_order_status_completed’ );
How can I get the current user email ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Woocommerce Paypal get current user inside order status completed’ is closed to new replies.