Home    Articles


How to get customer username and email from woocommerce order object or order id


Maybe you want to send an email or some notification regarding to an order.

This requires obviously an email that will be taken from the order object. To do that here are few code lines that will help you to get through.

# create woocommerce order object
$order = new WC_Order( $orderId );
# get email and name from this object
$email = $order->billing_email;
$name = $order->last_name.' '.$order->first_name;