# Personal Email Headings With the Customer's Name

> Changes the headings of customer order emails to greet the customer by first name, for example "Thanks for your order, Anna!".

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, email, personalisation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-email-personal-heading/

## Code

```php
$wpide_email_headings = array( // Email ID => heading.
    'customer_processing_order' => 'Thanks for your order, {first_name}!',
    'customer_completed_order'  => 'Good news, {first_name}: it is on its way!',
    'customer_on_hold_order'    => 'We have received order #{order_number}',
);

foreach ( $wpide_email_headings as $wpide_email_id => $wpide_heading ) {
    add_filter( 'woocommerce_email_heading_' . $wpide_email_id, function ( $heading, $order ) use ( $wpide_heading ) {
        if ( ! $order instanceof WC_Order || ! $order->get_billing_first_name() ) {
            return $heading;
        }

        return strtr( $wpide_heading, array(
            '{first_name}'   => $order->get_billing_first_name(),
            '{order_number}' => $order->get_order_number(),
        ) );
    }, 10, 2 );
}
```

## Notes

Edit the headings in $wpide_email_headings; {first_name} and {order_number} are replaced.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Personal Email Headings With the Customer's Name" 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/
