One of the use cases for wanting to do this is if you are going to be saving a ticket or in Tribe Events Ticket Plus, but would like to keep track of the ticket when it is moved into WooCommerce. Because by default you will be naming your tickets based on the title they were given when being created for each event. For example, the ticket would simply be called “Ticket”, or “Single”, but of course, you will want to specify this into something like the ticket’s SKU becoming the Event name.
To do so, you may use this snippet below from a solution I had come up with from a recent client:
/*
* Set Modern Tribe Event Tickets Plus custom SKU as:
* Title - StartDate
* @link https://www.sumner.co.uk/l/2NqELpA
*/
add_action( 'event_tickets_after_save_ticket', 'tribe_events_set_sku', 10, 4 );
function tribe_events_set_sku( $event_id, $ticket, $raw_data, $classname ) {
if ( ! empty( $ticket ) AND isset( $ticket->ID ) ) {
$event_start_date = str_replace(" ", "-", tribe_get_start_date( $event_id, false ));
$sku = sprintf( '%s - %s', get_the_title($event_id), $event_start_date );
update_post_meta( $ticket->ID, '_sku', $sku );
}
}
Please place this in your functions.php file, or in a plugin like Code Snippets which I recommend using (so that you can separate concerns between theme design, and website functionality.
This way, every time you save an Event in Tribe Events — a popular WooComemmerce plugin for an Event Management system — you will be able to save the ticket with a custom SKU. So rather than the SKU defaulting into something like the ticket name, with the post ID, it will become something more semantic or meaningful like the actual event it is associated with, as well as the start date of the event! Since it would be a little bit more in depth to have to reference in a custom code setup if you were to export a list of your attendees, this will be a massive time saver! Of course, it might not be in all cases that you will be making use of an SKU for inventory purposes. But if this is not the case, then it will be a good shout for you to use the code mentioned above.
Exporting a List of Attendees With Tribe Events
At the time of this writing, Tribe Events is still looking into implementing attendees export with their associated events all in one go, rather than the administrator having to peak into each and every event to check the attendees. There are workarounds for this though, which include exporting the entire WooCOmmerce tickets/orders through a plugin like WP All Export Pro, and from there you can reference the associated ticket with the SKU, and save this in something like Google Sheets, if you have called your tickets as “Tickets” or “Admit One”. This will be way easier than having to wait for Tribe Events to implement the feature. It is good though that it has been voiced out for its concerns and that it might be coming soon within 2019. But we can’t hope for now, but rather look towards a solution for the meantime. This will be the most likely solution (unless you might know of a better and more elegant one)?