👋 This article covers the template available with our legacy emails. For a full list of templates available with our new emails solution starting with Event Tickets version 5.6.0, see this article about Tickets Emails templates.

Event Tickets comes with a number of template files that determine how the plugin looks and behaves. We call these views. You can customize these views by placing copies of them in your theme. And that is valid for the email template as well.

The email template is important, in the sense that it is basically what your user will receive and use as a ticket. So, making it your own and including the information you want and in the way you want is important.

Fortunately, there are several ways to customize the ticket email template.

Customize via a Template Override

Customizing templates is something you might be familiar with if you worked on some TEC customizations already. If you haven’t, we’d recommend you to take a look at this article before moving forward.

First off, we need to find where the email template file is located in the plugin files. In this case, we’re customizing a template in Event Tickets. That means we can head over here to start looking, to find the template we’re looking for: /wp-content/plugins/event-tickets/src/views/tickets/email.php.

You can copy that template to [your-theme]/tribe-events/tickets/email.php and then make all the modifications you want.

At the top of the file, you can find the variables that you’ll receive and be available to use in that context.

Customize via Hooks

Customizing via hooks requires a bit more advanced skills but its flexibility allows you to customize the email template without having to work with template overrides.

The Ticket Email template comes with the following hooks:

Example Snippets Using Hooks

Add Events Calendar Pro Additional Fields to ticket emails

Events Calendar Pro comes with a pretty rad functionality called Additional Fields, which allows you to add fields to events. It’s great because you can display more information on your Event page. But what if you want to also include that information in your ticket email?

If you’re not sure how to use snippets, we have a handy Snippets Guide too.

Well, that could be possible by using the following snippet:

<?php
//* Do NOT include the opening php tag

add_action( 'tribe_tickets_ticket_email_after_details', 'tickets_events_pro_additional_fields_to_ticket_email_after_details', 10, 2 );

/**
 * Include ticket additional fields for the emails.
 *
 * @param array   $ticket The ticket data.
 * @param WP_Post $event  The post object.
 * @return void Template render has no return.
 */
function tickets_events_pro_additional_fields_to_ticket_email_after_details( $ticket, $event ) {
	$additional_fields = tribe_get_custom_fields( $event->ID );

	ob_start();
	?>
	<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
		<tr>
			<td>
				<h6 style="color:#909090 !important; margin:0 0 4px 0; font-family: 'Helvetica Neue', Helvetica, sans-serif; text-transform:uppercase; font-size:13px; font-weight:700 !important;"><?php esc_html_e( 'Zoom Password' ); ?></h6>
				<?php echo $additional_fields['Zoom Password']; ?>
			</td>
		</tr>
	</table>
	<?php
	$fields = ob_get_clean();

	echo $fields;
}

For the example above, the field Zoom Password is being sent to the user via email.

Add Event Tickets Additional Fields to Ticket Emails

Event Tickets Additional Fields is a nice extension of ours which gives you the possibility to have more fields for your tickets. It is great, and you should check it out (if you haven’t). Sometimes, you would need or want to display these additional fields in the ticket email.

And that can be achieved with a code like the one below:

<?php
//* Do NOT include the opening php tag

add_action( 'tribe_tickets_ticket_email_after_details', 'tickets_additional_fields_to_ticket_email_after_details', 10, 2 );

/**
 * Include ticket additional fields for the emails.
 *
 * @param array   $ticket The ticket data.
 * @param WP_Post $event  The post object.
 * @return void Template render has no return.
 */
function tickets_additional_fields_to_ticket_email_after_details( $ticket, $event ) {
	ob_start();
	?>
	<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
		<tr>
			<td>
				<h6 style="color:#909090 !important; margin:0 0 4px 0; font-family: 'Helvetica Neue', Helvetica, sans-serif; text-transform:uppercase; font-size:13px; font-weight:700 !important;"><?php esc_html_e( 'Zoom Link' ); ?></h6>
				<a href="<?php echo esc_url( tribe_ext_tickets_additional_fields_get_meta( $ticket['product_id'], 'zoom_link' ) ); ?>"><?php echo esc_html( tribe_ext_tickets_additional_fields_get_meta( $ticket['product_id'], 'zoom_link' ) ); ?></a>
			</td>
			<td>
				<h6 style="color:#909090 !important; margin:0 0 4px 0; font-family: 'Helvetica Neue', Helvetica, sans-serif; text-transform:uppercase; font-size:13px; font-weight:700 !important;"><?php esc_html_e( 'Zoom Password' ); ?></h6>
				<?php echo esc_html( tribe_ext_tickets_additional_fields_get_meta( $ticket['product_id'], 'zoom_password' ) ); ?>
			</td>
		</tr>
	</table>
	<?php
	$fields = ob_get_clean();

	echo $fields;
}

For the example above, there are two fields that are being sent to the user via email: zoom_link and zoom_password.

Remove the QR code from emails

In some cases, the QR code is not needed as part of your site tickets. It can be because you don’t do on-site registration or because you just don’t want to use them. Fortunately, you can also use hooks to remove these. All you need to do is use the following snippet:

<?php
// Include this in your theme's functions.php file.
if ( class_exists( 'Tribe__Tickets_Plus__Main' ) ) {
    remove_action( 'tribe_tickets_ticket_email_ticket_bottom', array( Tribe__Tickets_Plus__Main::instance()->qr(), 'inject_qr' ) );
}