WooCommerce Show Product Meta Under Product Name In Emails

WooCommerce email showing custom product meta field data under the product names


You need a way of facilitating adding product meta prior to showing it in emails. This could be through Advanced Custom Fields (ACF) assigned to the products post type.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

A lot of the time, the default WooCommerce product editor doesn’t give the user enough flexibility in assigning custom meta. If you’re using WooCommerce to sell events for example, you might want to install Advanced Custom Fields (ACF) to assign important attributes to products like the start time, venue, and organiser. In the emails, you may then wish to output this meta data under the relevant product name. This short snippet gives you the ability to show product meta (e.g. custom field data) under the product name in the WooCommerce emails. If you do have more than one custom field, simply assign another variable and replace the variable name and custom field name declaration.

* Snippet Name:     Show product meta (for example ACF field data) under the product names in the WooCommerce emails.
* Snippet Author:   ecommercehints.com

add_action( 'woocommerce_order_item_meta_start', 'ecommercehints_order_item_meta_start', 10, 4 );
function ecommercehints_order_item_meta_start($item_id, $item, $order, $plain_text) {
	$the_order_id = $order->get_id();
	$order_items = $order->get_items();
	$custom_field_variable = get_post_meta( $item->get_product_id(), 'custom_field_name', true ); // Change custom_field_name to the name of your custom product meta field
	echo '<p>' . $custom_field_variable . '</p>';

Snippet Benefits

  • Output important custom product fields data under the product names in the WooCommerce emails.
  • Give customers more clarity around their products.
  • Save money by editing the emails yourself instead of using an expensive email customisation plugin.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers