# Highlight the Customer's Order Note in Admin Emails

> Shows the note the customer wrote at checkout in a highlighted box at the top of the admin "New order" email, so special requests are not missed.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Requires: WooCommerce
- Tags: email, woocommerce, orders, notes
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-woo-customer-note-in-admin-email/

## Code

```php
add_action( 'woocommerce_email_before_order_table', function ( $order, $sent_to_admin, $plain_text ) {
    if ( ! $sent_to_admin || ! $order instanceof WC_Order ) {
        return;
    }

    $note = $order->get_customer_note();

    if ( '' === trim( $note ) ) {
        return;
    }

    if ( $plain_text ) {
        echo "CUSTOMER NOTE:\n" . esc_html( $note ) . "\n\n";
        return;
    }

    echo '<div style="margin:0 0 20px;padding:12px 16px;border-left:4px solid #dba617;background:#fcf9e8;"><strong>Customer note:</strong><br>' . nl2br( esc_html( $note ) ) . '</div>';
}, 5, 3 );
```

## Notes

Only appears when the customer left a note.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Highlight the Customer's Order Note in Admin Emails" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
