Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Send email to admin when a booking is cancelled
- This topic has 2 replies, 3 voices, and was last updated 1 year, 11 months ago by J. Davis.
- AuthorPosts
- December 3, 2022 at 12:33 pm #1386024BuenVivir CasaParticipant
Is there a way to notify the admin by email not only when a booking is confirmed, but also when it is cancelled?
December 5, 2022 at 3:59 am #1386643Mickael QuirinParticipantlooking 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,
MQDecember 13, 2022 at 2:24 pm #1390072J. DavisKeymasterHi,
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 Emailbest regards,
John Davis - AuthorPosts
- You must be logged in to reply to this topic.