Customise email depending on event category

WordPress Event Management, Calendars & Registration Forums General Question Customise email depending on event category

This topic contains 5 replies, has 3 voices, and was last updated by  Madeleine Parkyn 3 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #13376

    Hi, is there a way to customise the email sent to a bookee depending on what category of event they booked?

    I’ve created an event with a date in the far future allowing people to buy gift vouchers, so it’s not really an event at all. They get sent a discount code to use when booking a real event. But when they buy a gift voucher the email contains the date of the “event”, which will just confuse matters.

    Basically I’d like to remove the event date from the email for all bookings made for a ‘gift voucher’ category, or failing that the event id. Is this possible?

    Thanks for your help.

    Jon Packman
    #13401

    Hi Jon,

    You can use the eventorganiser_booking_confirmed_email_body filter. This passes the entire HTML mark-up of the content of the e-mail, (not the “window dressing” template you select inthe settings)

    Below is a skeleton example:

    add_filter( 'eventorganiser_booking_confirmed_email_body', 'my_change_booking_confirmation_email', 10, 2 );
    function my_change_booking_confirmation_email( $body, $booking_id ){
    
        $event_id = (int) eo_get_booking_meta( $booking_id, 'event_id' );
        if( is_object_in_term( $event_id, 'event-category', 'foobar' ) ){
             //change $body
             $message = "Text of e-mail. You can use the template tags still";
             $body = eventorganiser_email_template_tags( $message, $booking_id ); //replaces template tags
             $body = wpautop( $body );
        }
    
        return $body;
    
    }

    This should go in a utility plug-in (but can also go in your theme’s functions.php).

    Stephen Harris
    #13407

    That worked great, thanks Stephen.

    Jon Packman
    #39236

    Hello Stephen
    I’ve been using the code supplied above, to very successfully send a cutsomised email for an event booking, but now I need to send different customised emails for more than one
    event. How would I add another custom email, for a different category to the above code. Many thanks for your help, Madeleine

    Madeleine Parkyn
    #39244

    You would just add additional elseif clauses:

    if( is_object_in_term( $event_id, 'event-category', 'foobar' ) ){
         //change $body
         // ...
    }elseif( is_object_in_term( $event_id, 'event-category', 'another-category' ) ){
         //change $body
         // ...
    }
    
    Stephen Harris
    #39252

    Thanks so much Stephen. That should do the trick.

    I’m really impressed and thankful for how the Event Organiser has scaled-up for us duriing the pandemic. Thank you for all the creative work you’ve put into it.

    Best wishes
    Madeleine

    Madeleine Parkyn
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.