Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function attendee_export_add_phone_split_name( $items ) {
  2. $count = 0;
  3.  
  4. foreach ( $items as &$attendee_record ) {
  5. // Add the header columns
  6. if ( 1 === ++$count ) {
  7. $attendee_record[] = 'First Name';
  8. $attendee_record[] = 'Last Name';
  9. $attendee_record[] = 'Phone';
  10. }
  11. // Populate the new column in each subsequent row
  12. else {
  13. // order id is in the 6th index
  14. $order = wc_get_order( (int) $attendee_record[6] );
  15. $attendee_record[] = $order->billing_first_name;
  16. $attendee_record[] = $order->billing_last_name;
  17. $attendee_record[] = $order->billing_phone;
  18. }
  19. }
  20.  
  21. return $items;
  22. }
  23.  
  24. add_filter( 'tribe_events_tickets_attendees_csv_items', 'attendee_export_add_phone_split_name' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement