Steven,
I have already customised the ticket template that a bookee receives and it all works well.
I have an event organiser who wants a different appearance of their tickets with their own logo attached as an image.
Is there a way to have 2 or more templates for ticket styles which can be allocated on an event basis?
Thanks
Chris

Chris Hirst
Hi Chris,
Yes, there’s a filter that would allow you to pick the template:
add_filter( 'eventorganiser_booking_confirmed_email_template', function( $template, $booking_id ) {
// Set $template (filename) based on $booking_id.
// e.g. 'eo-email-template-blue.php'
return $template;
}, 10, 2 );
This affects the booking confirmation e-mail. It doesn’t affect any other e-mails – in particular, if you are using the ‘offline’ payment gateway and have configured Event Organiser to send an e-mail immediately after booking.

Stephen Harris
Stephen,
I have 2 templates at this time called eo-email-template-green.php and eo-email-template-red.php
I need to be able to allocate a particular template to a particular event.
Will the code you have sent me do that?
Is it a snippet that I can simply paste into the functions.php or plugin helper?
Or do I need to add to it.
Thank you for your help again
Chris

Chris Hirst
Hi Chris,
You can put it in either.
You would need to decide how you are going to allocate a template to an event. An easy (but error prone) way would be to use the custom fields. For example, say for each event add an email_template
key and enter eo-email-template-green.php
or eo-email-template-red.php
(or some of template name).
add_filter( 'eventorganiser_booking_confirmed_email_template', function( $template, $booking_id ) {
// Set $template (filename) based on $booking_id.
// e.g. 'eo-email-template-blue.php'
$event_id = eo_get_booking_meta( $booking_id, 'event_id', true );
//If a template has been set for this event, use that:
if( get_post_meta( $event_id, 'email_template', true ) ) {
$template = get_post_meta( $event_id, 'email_template', true );
}
return $template;
}, 10, 2 );
A more robust (less error prone) solution would be to present the user with a dropdownt to select the template, but that requires a bit more development.

Stephen Harris
Thanks very much – I will work with that

Chris Hirst