Hello,
I have a custom email template and I want to display a custom shortcode. It looks fine in the site and woocommerce email preview. I tried including it in a woocomerce email template. However, the script shows up. I’m using Customer new account email template and have removed most of the content in the body:
`<?php echo do_shortcode( ‘[short_code_sample]’ );?>`
In my functions.php, I have a function that creates the email. I do receive the email but the short code doesn’t render:
​
$mailer = WC()->mailer();
//format the email
$recipient = “[email protected]”;
$subject = “Upcoming Webinars!”;
$body = file\_get\_contents(get\_parent\_theme\_file\_path() .’/woocommerce/emails/custom-email.php’);
$headers = “Content-Type: text/html\\r\\n”;
​
//send the email through wordpress
$mailer->send( $recipient, $subject, $body, $headers );
Shortcodes only render in pages and posts. Can you access the shortcode’s callback function directly?