6.8 C
London
Thursday, April 2, 2026

Target WooCommerce Email Notification by Email ID

- Advertisement -spot_imgspot_img
- Advertisement -spot_imgspot_img

Customizing emails in WooCommerce can be tricky if you rely only on order status. A better approach is to target a WooCommerce email notification by email ID, which gives you precise control over each email type.

In this guide, you’ll learn how to use $email->id to customize WooCommerce emails efficiently with practical examples.

What is WooCommerce Email ID?

A WooCommerce email ID is a unique identifier assigned to each email notification.

Common Email IDs

  • new_order
  • cancelled_order
  • failed_order
  • customer_processing_order
  • customer_completed_order

These IDs help you directly target a WooCommerce email notification by email ID instead of relying on indirect conditions.

How to Target WooCommerce Email Notification by Email ID

🎯 Example Code

add_action('woocommerce_email_before_order_table', 'custom_email_logic', 10, 4);function custom_email_logic($order, $sent_to_admin, $plain_text, $email) {
    
    if ($email->id === 'new_order') {
        echo '<p>This content appears only in New Order emails.</p>';
    }}

Default WooCommerce Email Settings

Go to: 👉 WooCommerce → Settings → Emails

Here you can:

  • Enable/disable email types
  • Change email subject & content
  • Add recipient email IDs

How to Add Multiple Email IDs in WooCommerce

Simple Method (No Coding)

You can add multiple email addresses like this:

admin@example.com, manager@example.com, warehouse@example.com

👉 Works for:

  1. New order emails
  2. Cancelled orders
  3. Failed orders

Advanced WooCommerce Email Customization Using Code

If you want full control, use WooCommerce hooks.

Example: Add Custom Email Recipient

add_filter('woocommerce_email_recipient_new_order', 'add_multiple_recipients', 10, 2);function add_multiple_recipients($recipient, $order) {
    $recipient .= ', warehouse@example.com';
    return $recipient;
}

👉 This allows dynamic email control.

Real-World Use Cases

1. Notify Warehouse Team Only for Physical Orders

add_filter('woocommerce_email_recipient_new_order', 'warehouse_email', 10, 2);function warehouse_email($recipient, $order) {
    if ($order->needs_shipping_address()) {
        $recipient .= ', warehouse@example.com';
    }
    return $recipient;
}

2. Notify Manager for High-Value Orders

add_filter('woocommerce_email_recipient_new_order', 'high_value_order_email', 10, 2);function high_value_order_email($recipient, $order) {
    if ($order->get_total() > 10000) {
        $recipient .= ', manager@example.com';
    }
    return $recipient;
}

3. Send Emails Based on Product Category

👉 Example:

  • Electronics → Tech Team
  • Clothing → Inventory Team

Customize WooCommerce Email Content

You can also improve email design.

Steps:

  1. Go to WooCommerce → Emails
  2. Customize:
    • Header image
    • Footer text
    • Colors

Advanced (Template Override)

Copy files from:

/wp-content/plugins/woocommerce/templates/emails/

To:

your-theme/woocommerce/emails/

Then customize:

  • Layout
  • HTML
  • Content

❓ FAQs

1.What is WooCommerce email ID?

A unique identifier used to target specific email notifications.

2.Why use email ID instead of order status?

It provides more accurate and reliable email customization.

3.Can I customize WooCommerce emails without plugins?

Yes, using hooks and $email->id in code.

4.Is this method beginner-friendly?

Yes, with basic PHP knowledge.

- Advertisement -spot_imgspot_img
Latest news
- Advertisement -spot_img
Related news
- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here