WordPress WooCommerce ships eleven transactional emails (new order, processing order, completed order, refunded order, customer invoice, new account, reset password, and four more). They are functional out of the box and embarrassingly bland. Every store ends up customizing them. The pitfall is the maintenance path — most customizations live in the theme’s woocommerce/emails/ directory, the theme gets replaced or updated, the customizations vanish. The maintainable way is a thin override layer plus an ESP that owns the visual template.
What’s happening
WooCommerce email rendering goes through:
- WC_Email subclass. One per email type (e.g.,
WC_Email_New_Order,WC_Email_Customer_Completed_Order). The class assembles the recipient, subject, headings, and the data context. - Template files in
woocommerce/templates/emails/. PHP templates that render the HTML. Includes a header partial, the body content, and a footer partial. - Override path: theme’s
woocommerce/emails/. WooCommerce checksget_stylesheet_directory() . '/woocommerce/emails/<template>'before falling back to the plugin’s template. wp_mail()for delivery. WordPress core’s mail function. Hooked by WP Mail SMTP, Postmark, SendGrid, SES plugins to redirect to an ESP.
The three common pitfalls:
- Customizations in the theme die on theme replacement. A theme migration loses the work, nobody finds out until a customer complains the email looks broken.
- HTML rendered server-side with poor client compatibility. Outlook 2016 ignores 40 percent of CSS. WooCommerce defaults render reasonably; customizations often don’t.
- No ESP —
wp_mail()goes through PHP’ssendmail. Deliverability is poor. Gmail and Outlook flag the emails as spam or filter them to Promotions.
How to verify
# Which email templates have been overridden by the theme?
ls -la wp-content/themes/<active-theme>/woocommerce/emails/ 2>/dev/null
# Compare overridden templates to current plugin templates
diff -r wp-content/themes/<active-theme>/woocommerce/emails/ \
wp-content/plugins/woocommerce/templates/emails/ 2>&1 | head -50
# How many emails has wp_mail() sent recently?
# (requires WP Mail SMTP or similar logger)
wp db query "SELECT mail_to, subject, status, date_sent
FROM wp_wp_mail_smtp_emails ORDER BY date_sent DESC LIMIT 30"
# Which ESP plugin is wiring wp_mail?
wp plugin list --status=active --format=csv | grep -iE "smtp|postmark|sendgrid|ses|mailgun"
# Has the deliverability config been validated?
dig +short TXT example.com | grep spf
dig +short TXT default._domainkey.example.com
dig +short TXT _dmarc.example.com
# Test send from the WooCommerce admin
wp wc email send_test --email_type=customer_completed_order --recipient=ops@example.com
# Or via the WP-CLI mail plugin
wp mail test --recipient=ops@example.com --subject="WC test"
# Bounces / complaints reported by the ESP
# (Postmark / SES / SendGrid — check their dashboards)
The most useful single signal is the diff between overridden and current templates. If the theme is overriding a 2022 template and the plugin has shipped three updates since, the overridden template is missing the new fields (HPOS-aware footer, the new “Pay Order” button, etc.).
The fix
- Move overrides out of the theme into a child plugin. Create a minimal mu-plugin or a small custom plugin that filters the email content. This survives theme replacement.
// wp-content/mu-plugins/store-emails.php add_filter('woocommerce_locate_template', function ($template, $template_name, $template_path) { if (strpos($template_name, 'emails/') === 0) { $custom = WP_PLUGIN_DIR . '/store-emails/templates/' . $template_name; if (file_exists($custom)) return $custom; } return $template; }, 10, 3); - Use an ESP for delivery. WP Mail SMTP + Postmark / SendGrid / SES is the canonical shape. Set up the API integration via the plugin, set the From: address to a verified sending domain, confirm SPF and DKIM are aligned. The existing SPF/DKIM/DMARC article covers the DNS setup.
- Let the ESP own the visual template. Postmark and SendGrid both support transactional templates. WooCommerce sends a minimal payload (order data) and the ESP renders the email with its own template. The advantage: marketing or design can iterate on the template without touching WordPress.
- Test in actual mail clients before launch. Litmus and Email on Acid are the standard tools. The free-tier approach: send to a Gmail, an Outlook 365, an Outlook desktop, and an Apple Mail address. Check rendering. Outlook desktop is the canary — if it renders there, it will render anywhere.
- Monitor bounces and complaints. Postmark and SES surface bounce / complaint rates. Set up a webhook from the ESP to a Slack channel or a monitoring endpoint. Bounce rate above 2 percent or complaint rate above 0.1 percent is a deliverability problem.
- Keep the override layer thin. Override the header and footer partials only. The body templates (
customer-completed-order.php, etc.) should remain WooCommerce’s. WooCommerce will update those when HPOS or new payment flows ship — overrides break on updates.
For the deliverability baseline, the existing SPF/DKIM/DMARC and the WooCommerce abandoned-cart article are the prerequisites. Pair with enterprise WordPress support for the email-operations runbook.
Stack Harbor wires WordPress WooCommerce transactional email pipelines end-to-end under enterprise WordPress support — the ESP integration, the override layer, the deliverability posture, and the bounce monitoring. If your order confirmations are landing in Gmail Promotions or never showing up at all, we can audit and fix.