Hi,
I successfully filtered many of the default emails Hivepress sends, like Booking confirmed etc. Basically I create a shortcode with an addfilter and then paste the shortcode in the relevant empty Hivepress email template (in this example, Booking confirmed).
All of them work fine, except the order complete email. The code in the shortcode is very similar to all other shortcodes, but it always sends out an empty email with the subject defined in the Hivepress email template subject instead of the new one. An example of the code is
add_filter(
'hivepress/v1/emails/Order_Complete',
function( $email ) {
if ( !isset($email['tokens']['order_number']) ) {
return $email;
}
$order = wc_get_order( $email['tokens']['order_number'] );
if ( !$order ) {
return $email;
}
[...some more well tested code...]
$email['subject'] = 'My new subject';
$email['body'] = 'My new body';
return $email;
}
);
You can assume that it’s not a coding mistake, since it’s basically a copy of other working snippets, and I thoroughly checked.
Something is preventing the shortcode to execute. I tried with even simpler code, like only returning a changed body with no extra code, but nothing works.
Any help? Basically I wanted to use the Order Complete email into a “Request a review” email, changing the recipient, subject and body.
Thank you