I am using the following code to try to include the name of the purchased product in the additional paragraph that I have added to the completed order email in WooCommerce.
//Add to completed order email
add_action( 'woocommerce_email_after_order_table', 'add_email_information', 10, 2 );
function add_email_information( $order, $sent_to_admin ) {
if ( ! $sent_to_admin )
echo "<p>Your purchase for ' . $product . ', has been successful, thank you. Lorem ipsum dolor sit amet.</p>";
}
Instead of the product name a blank space is created where the product name should be. I think my concatenation of the variable is OK, so therefor I assume I am using the wrong variable. I have looked over the customer-completed-order.php tenplate and can't find reference to the variable anywhere. Any help much appreciated.