Sending Emails in WooCommerce

Sending Emails in WooCommerce

In 2022, WooCommerce had a market share of 36.68%, making it the leading e-commerce platform worldwide.

Transactional emails in WooCommerce: definition, importance, examples

Transactional emails are emails that are triggered when a user takes a specific action.

For example, when you forget your super difficult password (mydogmax111) for the 100th time and request a reset, you’ll receive an email with a password reset link. That would be a transactional email.

Such emails are important as they provide users with necessary information about further steps, confirm their action, or let them know if something was unsuccessful. Refer to this article to learn more about WordPress transactional emails.

By default, WooCommerce includes certain types of transactional emails that can be modified to match your needs. These are usually WooCommerce order emails:

  • New order – sent to site administrators

  • Canceled order – sent to site administrators

  • Failed order – sent to site administrators

  • Order on hold – sent to customers

  • Processing order – sent to customers

  • Completed order – sent to customers

  • Refunded order – sent to customers

  • Customer invoice / Order details – sent to customers

  • Customer note – sent to customers

  • Reset password – sent to customers

  • New account – sent to customers

These templates are available in plain text, HTML, or multipart formats. You can use them as they are or change their color or banner image. For that, you’d need to access WooCommerce email settings and scroll down to the ‘Email template’ section.

Customizing WooCommerce email templates from the settings page

It’s also possible to change a particular template, for example, processing order. Simply press the ‘Manage’ button across the template. Fill in the empty fields, such as email subject, heading, additional content, and choose the email type (text, HTML, or multipart). Finally, hit ‘Save changes’.

Customizing the content of the processing order template

If that’s not enough and you need more tweaks, just copy the template file below those fields by pressing ‘Copy file to theme’.

Navigate to the ‘Appearance’ tab in the WordPress dashboard and choose ‘Theme file editor’. You’ll see the ‘Theme files’ tab on the right portion of the screen. Scroll down to find ‘WooCommerce’. Expand it and press ‘emails’ which will open the menu with the list of templates you copied.

Choose the template you want to tweak and start coding.

Note: it’s recommended to create a child theme and make changes there to avoid losing all the customizations in the parent theme.

Customizing woocommerce email templates with code

WooCommerce’s default customization options are limited, but there are multiple plugins that can help with that (more on that below).

Though plugins enable you to customize the design, you still have to come up with the content yourself or use templates. Here’s an order confirmation template from Mailtrap:

Subject: Your [SERVICE] order confirmation

Your order is confirmed!

[NAME], thanks for shopping with us. Here are your order details:

[orderID]

[product + picture]

[quantity/other customizations]

[price_paid + payment method] // if payment by card, the last four digits should be used

[shipping + billing address]

We estimate that your order will arrive in 2-3 business days. Click the button below to track it.

TRACK YOUR ORDER

Forgot to add something? Here are the items our clients frequently buy together with [PRODUCT]. Get them within the next 24 hours, and we’ll ship everything together.

[FAQs]

Need any support? Send a reply to this message or contact us right away [link].

Thanks for your order and we hope you enjoy!

How to send emails in WooCommerce with the WP Mail SMTP plugin

As mentioned above, it’s possible to send emails programmatically from WooCommerce with the WordPress wp_mail() function. It calls PHP’s mail()function, which in turn connects with the local host to send emails. Check out this blog post to find more information about sending emails in WordPress.

Without header authentication, PHP’s mail() function is often blocked by WordPress hosting providers. Email servers don’t tolerate this function either, putting incoming emails in the spam folder.

But that’s not the only issue. WooCommerce emails might not be sent or delivered for other reasons as well (refer to the troubleshooting section below for more details).

WP Mail SMTP plugin (or any other SMTP plugin, for that matter) solves those problems by overriding the mail() function and allowing users to configure WordPress SMTP settings.

This plugin connects Gmail SMTP or third-party SMTP service. By doing so, it enables you to send multiple emails from your WooCommerce store regardless of your web host.

More information on setting up WordPress Gmail SMTP is available in another tutorial.

What other plugins can you use to customize and send emails in WooCommerce?

Post SMTP can be used as an alternative to WP Mail SMTP, while YayMail Email Customizer is one of the many plugins that can help with email customization. WooLentor customizer plugin also allows designing your own email template.

Post SMTP Mailer/Email Log

Post SMTP is a WordPress plugin that has the same concept as WP Mail SMTP: it overrides the PHP mail function and sends emails with an SMTP server.

This email plugin includes various features, including support for multiple SMTP servers, email logging and debugging, and the ability to customize the From address and subject line of outgoing emails. It also comes with a built-in SMTP test tool to help you troubleshoot any issues you may encounter.

YayMail – WooCommerce Email Customizer

YayMail WooCommerce Email Customizer is a WordPress plugin that allows you to customize email content and design.

With this plugin, you can easily edit the layout of default WooCommerce templates by customizing the colors, fonts, and images, and adding custom fields. These could be the customer’s first name or the order total. The plugin comes with shortcodes that can be used to create dynamic content such as customers’ order history, a list of related products, or coupon codes.

YayMail has a drag-and-drop menu for easy editing.

This guide was prepared by Mailtrap to make sending emails in WooCommerce more understandable.