Adding the Event Date to WooCommerce Order Email

When a user buys a ticket with Event Tickets Plus, they receive an order confirmation email that describes their purchase. It includes the information you might expect on a typical receipt or invoice—the name of the ticket, the total cost of the order, etc.

By default this email does not include the date of the event, and many users have asked us if they can change this. Adding the event date to your customers' order confirmation emails is indeed possible—all you have to do is add a code snippet like the following to your theme's functions.php file:

/**
* Adds event start date to ticket order titles in email and checkout screens.
*
* @return string
*/
function tribe_add_date_to_order_title( $title, $item ) {

$event = tribe_events_get_ticket_event( $item['product_id'] );

if ( $event !== false ) {
$title .= ' - ' . tribe_get_start_date( $event );
}

return $title;
}

add_filter( 'woocommerce_order_item_name', 'tribe_add_date_to_order_title', 100, 2 );

As an example of the power of this snippet, check out this screenshot of an order confirmation email before the above snippet is added:

]Screenshot
This is how an order confirmation email from Event Tickets Plus looks by default.

This screenshot below, meanwhile, shows how the email looks when the above code snippet is in place on your site:

Screenshot
This is how an order confirmation email from Event Tickets Plus looks with the event date added to the order items.