Sending an email in WordPress using your WooCommerce email design


Supposedly, this is what the wc_mail() function is supposed to do: help you send an email the way you might with wp_mail() BUT include your fancy WooCommerce template/design/styles around the content.

Well, it didn’t seem to be working for us, so after breaking it apart, we took the core function and wrote what we think should happen. It seems the key was adding line 15 here – the wrap_message() function.

Seems to be working so far, so I’m posting it here in case anyone is trying to send custom emails that bring in the WooCommerce template/design from their shop.

Sign up to receive my new posts in your inbox, along with some links and thoughts from the webdev world. No more than once a week. Browse the archive.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.