Calling in a customer’s company name as part of your WooCommerce admin-new-order.php email templates is a simple fix.

$order->billing_company


<?php if ($order->billing_company) : ?>
<p><strong><?php _e( 'Company:', 'woocommerce' ); ?></strong> <?php echo $order->billing_company; ?></p>
<?php endif; ?>

billing_email & billing_phone

This code snippet can be added below the billing email $order->billing_email and phone number $order->billing_phone calls that should already be in the admin-new-order.php email template file.


<?php if ($order->billing_email) : ?>
<p><strong><?php _e( 'Email:', 'woocommerce' ); ?></strong> <?php echo $order->billing_email; ?></p>
<?php endif; ?>
<?php if ($order->billing_phone) : ?>
<p><strong><?php _e( 'Tel:', 'woocommerce' ); ?></strong> <?php echo $order->billing_phone; ?></p>
<?php endif; ?>
<?php if ($order->billing_company) : ?>
<p><strong><?php _e( 'Company:', 'woocommerce' ); ?></strong> <?php echo $order->billing_company; ?></p>
<?php endif; ?>

 

A full list of available order fields can be found in the WooThemes documentation. If you’ve heavily customised your email template, make sure you’re calling in $order in some form if the values aren’t displaying.

Leave a comment