If you are using Event Tickets Plus and have more than one ticket for an event you may find that you would like to control the order in which the tickets appear — so that they are either ordered alphabetically by name or else in ascending order by price. This is actually fairly straightforward.

We are going to make use of template overrides, so if you have not already done so please do take the time to review our Customization Archives.

💡 The method shown here works with the Classic Editor. Block Editor Ticket Order can be modified by dragging and dropping the tickets within the block, as well as dragging and dropping the entire ticket block anywhere within the editor.  Customizing the code to sort will likely not work in the Ticket Block.

First, we need to add a short snippet to your theme’s functions.php file:

function tribe_tickets_custom_sort( $p, $q ) {
	if ( $p->name < $q->name ) {
		return -1;
	}

	if ( $p->name > $q->name ) {
		return 1;
	}

	return 0;
}

Then we need to override the event-tickets/src/views/v2/tickets/items.php template (by creating a custom copy in your theme) and add a single line of code.

Add the following code right below the first if statement (around line 42)

usort( $tickets, 'tribe_tickets_custom_sort' );

With that done you should find that tickets are ordered alphabetically. If you want to order them by price you can, alternatively, change the snippet that you added to your functions.php file:

function tribe_tickets_custom_sort( $p, $q ) {
	if ( $p->price < $q->price ) {
		return -1;
	}
	if ( $p->price > $q->price ) {
		return 1;
	}

	return 0;
}