Skip to content

Instantly share code, notes, and snippets.

@arixwap
Last active May 22, 2022 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arixwap/24e7b3d597faea0a08710ced83296e8f to your computer and use it in GitHub Desktop.
Save arixwap/24e7b3d597faea0a08710ced83296e8f to your computer and use it in GitHub Desktop.
Get woocommerce email template as string
<?php
/**
* Get WooCommerce Template Email
*
* Ref : https://gist.github.com/craigedmonds/b65c65e02fd40bd381bf023ffef2c80e
*/
function get_wc_template_email($content, $heading = false) {
$wc_mail = new WC_Email();
$message = wc_get_template_html('emails/custom-content.php', [
'content' => $content,
'email_heading' => $heading,
'sent_to_admin' => false,
'plain_text' => false,
'email' => WC()->mailer()
]);
return apply_filters( 'woocommerce_mail_content', $wc_mail->style_inline($message) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment