Hi,
Can you please give a snipped code with the hook you mentioned ? I dont know how do do It
For me it works, at last.
Sorry for the misunderstanding @ihor & @andrii.
Level 1 :
So let’s start simple
add_filter(
'hivepress/v1/emails/order_receive',
function( $email ) {
$email['tokens']['test'] = "Hello Bill";
return $email;
}
);
In your “order received” email template, use %test%
it should display “Hello Bill”.
Level 2 :
(expert mode)
add_filter(
'hivepress/v1/emails/order_receive',
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;
}
);
In your “order received” email template, use %customer.username%
it should display the name of this order’s customer, but you could access any other attribute available in the object.
Hope this helps and thank you guys !
Hi,
I am sorry but it still doesn’t work on my side, maybe I am missing something I don’t know… Can you help me please ?
Thank you
The snipped code is really not working for me. Can I share a temporary link with hivepress team please ?
This helped. I was able to set the listing_title token in the order receive email!
Thanks!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.