Add custom event field to email template

Home Forums Ticket Products Event Tickets Plus Add custom event field to email template

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1405815
    Raul
    Participant

    Hi!

    I added a custom field to Events and I want to include that field in the ticket email template.

    Can you tell me or give me an example or tutorial on how to modify email template adding that custom event field?

    It was nice if your plugin could enable an option to add some custom information in each event ticket (customized by event). Otherwise we have to modify the email template 🙁

    #1406768
    Brendan
    Keymaster

    Hi Raul,

    That should definitely be possible. In the first instance, please do check out our Themer’s Guide for a high level overview of setting up template overrides:

    theeventscalendar.com/knowledgebase/themers-guide

    In this case specifically, you’ll probably want to make a copy of event-tickets/src/views/tickets/email.php and place that copy in YOUR_THEME/tribe-events/tickets/email.php – you can then safely modify the ticket email.

    If you look inside that, you’ll see that there is a line of code looking like this:

    $event = get_post( $ticket['event_id'] );

    At any point after that, you can therefore access the event and the event’s post ID – and can use that to pull in data from any custom fields you have created, something like this:

    $address = get_post_meta( $event->ID, '_hidden_address_field', true );

    Simply echo or print this data at a suitable point in the flow of the email. Does that help at all?

    Thanks,
    Brendan

    #1407803
    Raul
    Participant

    It works fine and solves my problem. But it would be great if this kind of situation could be contemplated in future updates of ticket plus plugin as an option not modifying templates.

    Thank you

    #1408307
    Brendan
    Keymaster

    Hi Raul,

    Thats great and we are always looking for ways to improve our plugins for our customers so I have let the correct developers know.

    Thanks,
    Brendan

    #1421477
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add custom event field to email template’ is closed to new replies.