Skip to content

Instantly share code, notes, and snippets.

@Critter
Created April 26, 2017 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Critter/d9d9aef4069de588a816d7e6015706aa to your computer and use it in GitHub Desktop.
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
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