You’re ready to launch your WooCommerce store. Everything looks beautiful, products are up, and you even added your own custom email templates so customers get a personalized touch. Then it happens—you test an order and no email shows up in your inbox. You check again. Still nothing. Panic mode activated.
TL;DR
After enabling custom WooCommerce email templates, your store may stop sending email notifications—especially new order emails. This usually happens because your custom templates override default behavior and don’t hook into WooCommerce properly. Fixing the hook priority for your email actions can bring things back to life. It’s a tiny tweak that makes a HUGE difference!
Where Did the Emails Go?
WooCommerce relies on email actions and hooks to send notifications when something happens—like a new order. These hooks are like scheduled triggers. When you add custom email templates, you might accidentally break these triggers. The emails don’t get sent because WooCommerce simply doesn’t know when to send them!
Here’s what could go wrong:
- You replaced the default template, but didn’t copy ALL required logic
- Your custom email class didn’t register correctly
- Your hook to trigger email notifications runs too late, after WooCommerce stops caring
What Actually Sends an Email in WooCommerce?
When someone places an order, WooCommerce uses the woocommerce_email_actions hook to alert its email system. This hook is tied into core status changes like “processing” or “completed.”
For instance, when a new order comes in, WooCommerce listens for woocommerce_new_order. If hooked properly, it sends the “New Order” email to the store admin. Simple, right?
Until you add a custom template and forget to hook it in—or worse, hook it after WooCommerce finishes listening.
Okay, So What Did You Change?
Let’s say you created a fancy new class called WC_Email_Custom_Order_Confirmation and placed it in your theme or plugin. You then registered it using this code:
add_filter( 'woocommerce_email_classes', 'add_custom_email_class' );
function add_custom_email_class( $email_classes ) {
require_once 'emails/class-wc-email-custom-order-confirmation.php';
$email_classes['WC_Email_Custom_Order_Confirmation'] = new WC_Email_Custom_Order_Confirmation();
return $email_classes;
}
Looks harmless, right? Nope. You just changed how WooCommerce processes email classes. And if that class doesn’t bind early enough to the action hooks, WooCommerce skips the send process entirely.
Why Priority Matters
WordPress and WooCommerce both use action hooks with something called priority. Priority decides when your function runs compared to others listening to the same hook.
By default, many WooCommerce email triggers fire between priorities 10 and 20. If your custom email logic hooks in at, say, 25 or 30, it’s already too late. The moment has passed. Bye-bye email notification!
The Fix? Tweak That Priority!
Here’s the golden nugget. You need to make sure WooCommerce registers your custom templates and email classes before it processes order events.
Add your email class with a lower priority. Here’s how:
add_action( 'woocommerce_email', 'load_custom_email_template', 5 );
function load_custom_email_template( $email_class ) {
require_once 'emails/class-wc-email-custom-order-confirmation.php';
$email_class->emails['WC_Email_Custom_Order_Confirmation'] = new WC_Email_Custom_Order_Confirmation();
}
Notice the 5 in the add_action? That’s priority. Lower is higher—this runs earlier than WooCommerce’s default email actions.
It’s All in the Timing
Think of WooCommerce order notifications like passengers boarding a train. If your email class arrives late at the station, it misses the train (the “new order” event). By setting a lower priority, your code gets there early—first in line with its suitcase of email love.
How to Know It’s Working
Place a test order. Did you get the email right away? Awesome. No more crickets in the inbox. If you want to be really sure things are running smoothly, enable WooCommerce email debug mode. Just add:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
Then check your wp-content/debug.log file after placing an order.
Pro Tips for Smooth Sailing
- Don’t forget to include all required email methods:
trigger(),get_default_heading(), etc. - Check your email content type: If your email should be HTML, set it in the class with
$this->content_type = 'text/html'; - Use unique IDs: WooCommerce must know how to tell your email class apart from others
Bonus: Do You Even Need a Custom Template?
Sometimes, all you want to do is change the branding. You don’t need a whole new email class for that. Just override the existing WooCommerce templates in your theme at:
yourtheme/woocommerce/emails/
Want to make the email appear different but still trigger correctly? Stick with the default WooCommerce email and just adjust the template design instead of rebuilding the action hook wheel!
Final Thoughts
So many WooCommerce store owners go down the rabbit hole of custom emails, only to break the very thing that makes eCommerce tick—timely notifications. But now you know the trick. Always respect priorities in your hooks.
Load your custom email templates early. Hook onto WooCommerce’s email system before it starts ringing the email bell. Respect the timing, and your custom emails will sing like a charm.
happy user, success, email inbox, wooCommerce store[/ai-img>
That one small priority number change? It’s the reason your emails go from ghosted to glorious.
