Send Automatic Email to Customers When an Order Is Cancelled in WooCommerce

Keeping your customers informed is key to building trust in your online store. By default, WooCommerce does not automatically notify customers when their orders are cancelled, which can cause confusion and unnecessary support requests.

In this tutorial, you’ll learn how to automatically send an email to your customer whenever their order is cancelled using a simple code snippet. This will improve communication, save you time, and ensure your WooCommerce store feels more professional.

Why Send a Cancellation Email in WooCommerce?

When a customer’s order is cancelled without notification, they may:

  • Wonder if their payment was processed correctly.

  • Contact your support team for clarification.

  • Feel less confident about shopping with you again.

By automatically sending a cancellation confirmation email, you can:

  • Keep your customers informed.

  • Reduce support tickets.

  • Enhance the overall shopping experience.

The WooCommerce Cancellation Email Snippet

Here’s a simple PHP snippet you can add to your theme’s functions.php file or a custom plugin.

🐘
woocommerce-send-cancelled-order-email.php
Copy to clipboard
// Automatically notify customer when an order is cancelled (uses Customer Note email)
add_action('woocommerce_order_status_cancelled', function( $order_id ){
    $order = wc_get_order( $order_id );
    if ( ! $order ) return;

    $msg = 'Your order #' . $order->get_order_number() . ' has been cancelled. '
         . 'If this was a mistake or you need assistance, please contact us.';

    // true => sends the note to the customer via the default WooCommerce email template
    $order->add_order_note( $msg, true );
});

How This Snippet Works

It hooks into woocommerce_order_status_cancelled.

When an order is marked as Cancelled, WooCommerce automatically sends a Customer Note email.

The email includes your custom message, keeping customers informed right away.

Best Practices

✅ Always test on a staging site before deploying to production.

✅ Customize the cancellation message to match your brand tone.

✅ Consider translating the email for multilingual stores.

✅ Use a child theme or custom plugin to prevent losing changes after theme updates.