# Personal Thank-You Message After Purchase

> Replaces the standard "Thank you. Your order has been received." text with a friendlier message that includes the customer first name.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, thank-you, orders
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-custom-thank-you-text/

## Code

```php
add_filter( 'woocommerce_thankyou_order_received_text', function ( $text, $order = null ) {
    $name = $order instanceof WC_Order ? $order->get_billing_first_name() : '';

    if ( '' === $name ) {
        return 'Thank you! Your order has been received and a confirmation email is on its way.';
    }

    return sprintf( 'Thank you, %s! Your order has been received and a confirmation email is on its way.', esc_html( $name ) );
}, 10, 2 );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Personal Thank-You Message After Purchase" 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/
