Add booking note(purchase note) to the booking confirmation email

Hello, I am trying to add the vendor’s booking note (aka purchase note) to the booking confirmation email. I tried adding the token %booking.note% but it did not pull over the booking note for that listing. Please help.

Hi,

Unfortunately, this token is not available because it is optional content. But we can provide a PHP snippet on our end, let us know if that works for you.

Andri, yes that will work!

I’m sorry for the delay. Please try this code snippet:

add_filter(
	'hivepress/v1/emails/booking_confirm_user',
	function( $email ) {
		if ( isset( $email['tokens']['listing'] ) ) {
			$listing = $email['tokens']['listing'];

			if ( $listing->get_purchase_note() ) {
				$email['tokens']['booking_note'] = $listing->get_purchase_note();
			}
		}

		return $email;
	}
);

Then the %booking_note% token should become available.

1 Like

That worked! Thank you.

I’m sorry for the inconvenience, it appears that there’s no simple code snippet for this. The snippet I posted seems to be ok, but if it causes issues mentioned in this topic Booking Confirmation (User) Email issue - #12 by zackgoble4 then I recommend removing it, because we can’t debug issues caused by customizations - this is beyond our support scope. If you’re familiar with development basics or have a developer for custom work, I recommend using the suggested snippet as a starting point.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.