The token "%user%" and "%listing%" don't work

Hi,
As you can see in the image below, the token “%user%” doesn’t work. Can you help me to solve it please ?

Same for the mail " your booking is soon" for customer, the token “%listing%” doesn’t work.

Many thanks for your help

the first token “%user%” is for the mail " new order received" for vendor.

Salut Biloute !

%user_name% 
%listing_title%
%listing_url%

work instead.

Hope this helps.

Hi,
For the first email, %user_name% is already used to inform the vendor that he received a new reservation. But I would like to inform the vendor what is the name of the customer. So I can’t use %user_name% for both. It works only for the name of the vendor. Do you have a solution to name the customer in this email please ?
Thanks for your feedback

Hello again,

Let me remind you that I am not part of the support team. Just trying to help out.
Second, I am not using the booking plugin itself, as it seems you do.

So our token might be different.

Maybe try %sender.display_name%, that’s another option which worked out for me (for “messages” template).

Maybe in your case, it could be %customer.display_name% or %tenant.display_name%. I don’t know. One’s got to be creative, as documentation regarding tokens is scarce.

Hope this helps !

1 Like

Hi,
Thanks for your help.
May I have also a feedback from hivepress team please ?

Thank you!

Does anyone know how to add additional tokens to an email? One thing I am trying to add is the listing_title to the Order Received email.

Hi,

If you mean to display the vendor and customer name in the Order Received email, then the user token is not included in this template. But, if you are familiar with coding or have a developer, we can provide general guidance to add a new token.

Hi,
Yes if you can provide me general guidance, that would be helpful.
Thank you !

Hi,

Please stay tuned to this topic, we will provide general guidance on how to add other tokens soon.

Thank you that would be very helpful. I’m been trying to figure it out myself programatically for a couple of days without much luck.

Please try following guidance from this topic Add custom token to email template - #8 by andrii Using these hooks, it’s possible to fetch the existing email tokens, and set new one based on them.

Hope this helps

1 Like

Hi,
Can you please tell me how can implement the token :“%user%” for the mail " new order received" for vendor.
Because I did not really understand.
Many thanks for your feedback

You can try this one, it should add the “customer” token to the Order Received email. Please note that it’s not tested.

add_filter(
	'hivepress/v1/emails/order_received',
	function( $email ) {
		$order = wc_get_order( absint( str_replace( '#', '', $email['tokens']['order_number'] ) ) );

		if ( $order && $order->get_customer_id() ) {
			$email['tokens']['customer'] = \HivePress\Models\User::query()->get_by_id( $order->get_customer_id() );
		}

		return $email;
	}
);