Created
April 26, 2017 14:53
-
-
Save Critter/d9d9aef4069de588a816d7e6015706aa to your computer and use it in GitHub Desktop.
function to add phone number to tickets pro export and split out customer name
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
function attendee_export_add_phone_split_name( $items ) { | |
$count = 0; | |
foreach ( $items as &$attendee_record ) { | |
// Add the header columns | |
if ( 1 === ++$count ) { | |
$attendee_record[] = 'First Name'; | |
$attendee_record[] = 'Last Name'; | |
$attendee_record[] = 'Phone'; | |
} | |
// Populate the new column in each subsequent row | |
else { | |
// order id is in the 6th index | |
$order = wc_get_order( (int) $attendee_record[6] ); | |
$attendee_record[] = $order->billing_first_name; | |
$attendee_record[] = $order->billing_last_name; | |
$attendee_record[] = $order->billing_phone; | |
} | |
} | |
return $items; | |
} | |
add_filter( 'tribe_events_tickets_attendees_csv_items', 'attendee_export_add_phone_split_name' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment