Saving email token into a variable

How can I save one of the email token into a variable in function.php.
here’s what I have started

$request1 = hivepress()->request->get_context( ‘request.date_request1’ );

but this code is obviously not working. which part have I got it wrong.

Please post a full snippet, is it a custom function hooked to the email send action, or the email parameters filter? If possible describe the required changes, maybe there’s a simple solution or a workaround.

The required change is to change the recipient of email.

e.g. I want to send an email when the order is completed to vendor and customer.
(preferably different text)

I understand that woo commerce already has an option to send order completed email to the customer. However, They don’t allow me to use Hivepress token such as %request.title%.
So I want to save %request.title% as a variable somehow and implement it into a woo commerce snippet.

Here’s the full snippet

//email customization on woocomerce
add_action( 'woocommerce_email_header', 'mm_email_header', 10, 2 );
function mm_email_header( $email_heading, $email ) {
	
	$request1 = hivepress()->request->get_context( 'request.date_request1' );
	echo "
	<p> Some Main discription</p>
	<p>your preffered time</p>
	<ul>
 	<li>$request1</li>
 	<li>%request.data_request2%</li>
 	<li>%request.date_request3%</li>
 	<li>%request.date_request4%</li>
	</ul>
	<p>Tutors message</p>
	<li>%offer.text%</li>
	
	";}

Yes, unfortunately there’s no easy way to include the HivePress request or listing context into WooCommerce emails at the moment, this would require a custom implementation. WooCommerce emails are aware about the order details only.

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