Add WooCommerce variation attributes to order emails (admin & customer)

Looking to add specific order variation attributes to your WooCommerce customer and admin order emails? All you need to add a line of code for each attribute.

Showing a variation attribute on a WooCommerce order email

In order to show a variation attribute on your WooCommerce order emails (for both admin and customer), follow the steps below:

  1. Copy the email-order-items.php WooCommerce email template across into your theme’s directory, using this guide.
  2. Within this file, within your <tr><td></td></tr> tags for the $items foreach statement, add the line of code shown below.
echo '<br/><small>' . nl2br( $product->get_attribute( 'attribute_name' ) ) . '</small>';