Last active
May 22, 2022 08:36
-
-
Save arixwap/24e7b3d597faea0a08710ced83296e8f to your computer and use it in GitHub Desktop.
Get woocommerce email template as string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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