How to add customer email and phone in order email of WooCommerce


Sometimes a store manager finds a bit difficult to find customer’s contact information from the order management of WooCommerce. To make them easy to find customer information, we can add the customer’s email address and phone in the order email. The order email is sent to the store manager when a customer placed an order on the website.

For example, the following screenshot shows customer details added in the order notification email.

Having a customer’s contact information in the email makes it easy for store managers to contact them easily.

We need to write a hook that will modify order email and add customer contact information.

Open functions.php of your child theme and add the following snippet:

// WooCommerce admin order email - add customer information
function woo_order_email_customer_details( $order ) {
$phone= $order->get_billing_phone();
 <h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
   <li><strong><?php echo wp_kses_post( 'Email address'); ?>:</strong> <span class="text"><?php echo wp_kses_post( $email ); ?></span></li>
<?php if($phone) { ?>
     <li><strong><?php echo wp_kses_post( 'Phone'); ?>:</strong> <span class="text"><?php echo wp_kses_post( $phone ); ?></span></li>
  <?php } ?>

add_action( 'woocommerce_email_customer_details', 'woo_order_email_customer_details', 10, 4 );

Note: Please open and close PHP tags according to your functions.php of the child theme.

The above snippet will add the customer’s email and phone in the order email.

Now, the store managers can easily get customer’s contact information with the order email.


Related Posts