FooEvents For WooCommerce
Selling event tickets? Need attendee names, emails, and ticket types in your exports?
Standard WooCommerce exports only show the product name. Not who’s attending.
Here’s how to pull FooEvents ticket data into your exports.
What this code does
It replaces regular product rows with ticket data. Each ticket becomes its own row. Attendee info appears in separate columns.
Export columns include:
- Ticket Type
- Ticket Status
- Attendee First Name
- Attendee Last Name
- Attendee Email
- Attendee Phone
- Attendee Company
- Attendee Designation
- Purchaser First Name
- Purchaser Last Name
- Purchaser Email
- Booking Slot
- Booking Date
- Custom Registration Type
The complete code
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
//if you need Seating fields -- please, contact us and provide all necessary plugins! class WOE_FooTickets_As_Products { var $fields = array( "TicketType" => "Ticket Type", "Status" => "Ticket Status", "AttendeeName" => "Attendee First Name", "AttendeeLastName" => "Attendee Last Name", "AttendeeEmail" => "Attendee Email", "AttendeeTelephone" => "Attendee Phone", "AttendeeCompany" => "Attendee Company", "AttendeeDesignation" => "Attendee Designation", "PurchaserFirstName" => "Purchaser First Name", "PurchaserLastName" => "Purchaser Last Name", "PurchaserEmail" => "Purchaser Email", "BookingSlot"=>"Booking Slot", "BookingDate"=>"Booking Date", ); var $custom_fields = array( "Registration Type" => "Custom Registration Type", ); // var $seating_fields = array("seat_row_name" => "Seating"); function __construct() { add_action("woe_settings_above_buttons", array($this, "draw_options")); add_filter("woe_settings_validate_defaults", array($this, "modify_export"), 10, 1); add_filter('woe_get_order_product_fields', array($this, "add_product_fields"), 10, 1); } function draw_options($settings) { $selected = !empty($settings['fill_foo_fields']) ? 'checked' : ''; echo '</code><br /><br /><code> <input name="settings[fill_foo_fields]" type="hidden" value="0" /> <input name="settings[fill_foo_fields]" type="checkbox" value="1" /> <span class="wc-oe-header">Export Foo Events fields</span></code><br /><code>'; } function modify_export($current_job_settings) { if (!empty($current_job_settings['fill_foo_fields'])) add_filter('woe_fetch_order_products', array($this, "fill_foo_fields"), 10, 5); return $current_job_settings; } function add_product_fields($fields) { $fields = [];// Alex - export only ticket fields foreach ($this->fields as $field => $label) $fields['ticket_standard_' . $field] = array('label' => $label, 'colname' => $label, 'checked' => 1); foreach ($this->custom_fields as $key=>$label) $fields['ticket_custom_' . $key] = array('label' => $label, 'colname' => $label, 'checked' => 1); //foreach ($this->seating_fields as $field => $label) // $fields['ticket_seating_' . $field] = array('label' => $label, 'colname' => $label, 'checked' => 1); return $fields; } function fill_foo_fields($products,$order,$labels, $format, $static_vals) { $tickets_query = new WP_Query( array( 'post_type' => array( 'event_magic_tickets' ), 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'WooCommerceEventsOrderID', 'value' => $order->get_id(), 'compare' => '=', ), ), ) ); $tickets = $tickets_query->get_posts(); $tickets_set = []; foreach($tickets as $ticket_obj){ $meta = get_post_meta($ticket_obj->ID); $tickets_set[$ticket_obj->ID] = $meta; } //$tickets_set = get_post_meta($order->id, "WooCommerceEventsOrderTickets", true); $this->line_id = 1; $results = array(); $pos = 0; $products = array_values($products); $tickets_exported = []; foreach ( $order->get_items('line_item') as $item_id=>$item ) { $found_ticket = false; // seek for assigned tickets $product_data = $products[$pos++]; // take already extracted data for product! foreach($tickets_set as $idx=>$ticket) { // found assigned tickets?? if( $item['product_id'] AND !$item['variation_id'] AND ($ticket['WooCommerceEventsProductID'][0] == $item['product_id']) OR $item['variation_id'] AND ($ticket['WooCommerceEventsVariationID'][0] == $item['variation_id']) ) { $found_ticket = true; // Alex - export only ticket fields $ticket_id = $ticket['WooCommerceEventsTicketID'][0]; if( in_array($ticket_id, $tickets_exported) ) continue; $tickets_exported[] = $ticket_id; $custom_fields = get_post_meta( $item['product_id'], 'fooevents_custom_attendee_fields_options_serialized', true ); if($custom_fields ) $custom_fields = json_decode($custom_fields, true); $this->add_ticket($results, $ticket,$labels,$product_data,$custom_fields); // var_dump($item_id, $ticket); die("xx"); // unset($tickets_set[$idx]);// use each ticket only ONCE! } } if( ! $found_ticket ) // not ticket, stay unchanged! $results[] = $product_data; } return $results; } function add_ticket(&$results, $ticket,$labels,$product_data,$custom_fields) { $WooCommerceEventsCustomAttendeeFields = array(); if(!empty($custom_fields)) { foreach($custom_fields as $key=>$data) $WooCommerceEventsCustomAttendeeFields[$data[$key.'_label']] = $ticket["fooevents_custom_" .$key][0]; } $row = array(); foreach ( $labels as $field => $label ) { if ( $field == 'line_id' ) { $row[ $field ] = $this->line_id++; } elseif ( preg_match('#ticket_standard_(.+)$#',$field,$m) ) { // FooEvents field $row[ $field ] = $ticket["WooCommerceEvents".$m[1]][0]; } elseif ( preg_match('#ticket_custom_(.+)$#',$field,$m) ) { // FooEvents custom field $row[ $field ] = isset($WooCommerceEventsCustomAttendeeFields[$m[1]]) ? $WooCommerceEventsCustomAttendeeFields[$m[1]] : ""; //} elseif ( preg_match('#ticket_seating_(.+)$#',$field,$m) ) { // FooEvents seating field // $row[ $field ] = str_replace('_', ' ',$ticket["WooCommerceEventsSeatingFields"]["fooevents_".$m[1]]); } elseif ( isset( $product_data[$field]) ) { // Item field ? $row[ $field ] = $product_data[$field]; } else $row[ $field ] = ''; } $results[] = $row; } } new WOE_FooTickets_As_Products(); |
Setup steps
- Copy the entire code block
- Paste into your theme’s
functions.php - Go to Advanced Order Export for WooCommerce
- Create or edit an export profile
- Open Setup Fields → Products
- You’ll see all ticket fields available. Check the ones you need
- Save the profile
- Run a test export on an event order
What you’ll see
| Ticket Type | Attendee First Name | Attendee Email | Booking Date |
|---|---|---|---|
| VIP Pass | John Smith | [email protected] | 2026-06-15 |
| General Admission | Jane Doe | [email protected] | 2026-06-15 |
Each ticket gets its own row. No more guesswork.
Custom fields
The code includes $custom_fields array. Edit it to match your FooEvents custom attendee fields.
Replace “Registration Type” with your actual field label. Add more rows if you have multiple custom fields.
Seating fields
Need seat numbers? The code has commented seating sections. Uncomment them if you use FooEvents seating addon.
Contact plugin support for help with seating exports. Different seating plugins need different code.
Common mistake
Not having FooEvents installed and active. The code checks for ticket post types. No tickets? No data exports.
Also, the code assumes standard FooEvents field names. If your plugin version uses different meta keys, edit the $fields array accordingly.
One ticket exported multiple times?
The code includes $tickets_exported tracking. Prevents duplicates. Each ticket exports once.
Pro tip
Want only ticket data? The line $fields = []; clears default product fields. Comment it out to keep both product and ticket data.
Need additional ticket fields? Add them to the $fields array. Look in your database for the exact meta key name.
Real talk
This code is specific to FooEvents. Won’t work with other event plugins.
Test thoroughly before running on live events. Export one order. Verify every attendee appears correctly.
Advanced Order Export for WooCommerce handles the export engine. This code pulls ticket data from FooEvents tables.
Your event team gets clean attendee lists. No manual data entry.