Is there any way to split the attendee name into separate fields?

Home Forums Ticket Products Event Tickets Plus Is there any way to split the attendee name into separate fields?

  • This topic has 3 replies, 3 voices, and was last updated 9 years ago by Critter.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1274647
    Critter
    Participant

    When the attendee list is exported from the event, the name is in one field. Is there any way to modify or patch a function so that the export splits the name into separate fields?

    #1274683
    Critter
    Participant

    I found a solution and modified it to fit my needs.

    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' );
    #1275056
    Victor
    Member

    Hi Critter!

    Thanks for letting us know about that and for posting your solution here so other users may benefit from it.

    I’ll go ahead and close this thread, but do not hesitate to open a new one when needed.

    Best!
    Victor

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Is there any way to split the attendee name into separate fields?’ is closed to new replies.