Use Woocommerce email template header/footer with your code

55 Likes Comment

Sometimes I had a question how to send an email in WordPress (which uses Woocommerce), but to send so that the letters included templates header/footer of Woocommerce email system.

<?php

$user_email = '[email protected]';
$subject    = 'Test Subject';

ob_start();
wc_get_template(
    'emails/email-header.php',
    array('email_heading' => 'Example')
);

?>
    <p>Hello</p>
    <p>The example, how to use Woocommerce email template header/footer with your code</p>
    <p>Thanks</p>
<?php

wc_get_template('emails/email-footer.php');
$message = ob_get_clean();
$mailer->send($user_email, $subject, $message);

?>

 

You might like

About the Author: Oleksandr Sovenko

Back-End Web Developer. Currently I spend my days working as a remote web developer of EstPress

Leave a Reply

Your email address will not be published. Required fields are marked *