Created
February 4, 2016 22:59
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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