Skip to main content
WooCommerce

WooCommerce – adding company name to order email

By July 17, 2015One Comment

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.

Andrew Taylor

A senior UI designer with over 25 years of web design and web development experience working for some of the largest companies in the UK. An expert in all things Magento and WordPress.

One Comment

  • Laurence says:

    Hi Andrew,

    is there a way to display the default ‘billing_address_2’ (or any other) field in the e-mail subject?
    I’ve tried just adding {billing_address_2} to the Subject field under Woocommerce Email Settings but it didn’t work.
    Thanks for your help.

    Laurence

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.