Skip to content

Instantly share code, notes, and snippets.

@elimn
Created February 4, 2016 22:59
Show Gist options
  • Select an option

  • Save elimn/9352efba6accd9dc21a1 to your computer and use it in GitHub Desktop.

Select an option

Save elimn/9352efba6accd9dc21a1 to your computer and use it in GitHub Desktop.
MT | ETP | Add event start date to ticket titles in email order and checkout screens
<?php
/*
* Adds Event start date to ticket order titles in email order and checkout screens
* NOTE: For recurring events the start date is always the first event in the series
* not the start_date of the recurrence the user was viewing when placing their order
*
* @param string $title Title of the product, for tickets this is the ticket name
* @param array $item The product details as generated by Woo
*/
function tribe_add_eventdate_order_title_wootickets ( $title, $item ) {
$event = tribe_events_get_ticket_event( $item['product_id'] );
$event_title = get_the_title( $event );
$event_start_date = tribe_get_start_date( $event );
if ( $event !== false ) {
$title .= ' - '.$event_start_date;
}
return $title;
}
add_filter('woocommerce_order_item_name', 'tribe_add_eventdate_order_title_wootickets', 100, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment