Send email to admin when a booking is cancelled

Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Send email to admin when a booking is cancelled

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1386024
    BuenVivir Casa
    Participant

    Is there a way to notify the admin by email not only when a booking is confirmed, but also when it is cancelled?

    #1386643
    Mickael Quirin
    Participant

    looking at the code I did find a hook when a booking is cancelled : mphb_booking_cancelled

    so theorically you could do this:

    
    function send_admin_mail_on_booking_cancel($booking, $oldStatus) {
    $recipient = '[email protected]'; //change it to yours
    $subject = "Booking #" . booking->getId() . " is cancelled";
    
    $message = "Booking #" . $booking->getId() . " is cancelled";
    
    wp_send_mail($recipient,$subject,$message);
    }
    
    add_action('mphb_booking_cancelled','send_admin_mail_on_booking_cancel',10,2);
    

    The message is pretty short right know and I didn’t test it either (mainly because I disabled cancel option), but if its working for you, you can ask me the message you want to put and I’ll try to give you the code for it.

    if you’re willing to test it, you need to put that in your function.php file in your theme or install code snippets plugin and add a new snippet with this code.

    Regards,
    MQ

    #1390072
    J. Davis
    Keymaster

    Hi,

    You need to make sure the following option is enabled at Accommodation > Settings User can cancel booking via link provided inside email..
    Then you may navigate to Accommodation > Admin Emails and configure email template Cancelled Booking Email

    best regards,
    John Davis

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.