# Email the Shop When a New Customer Registers

> Sends the shop owner a short email whenever someone creates a customer account, at checkout or on the My Account page.

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

## Code

```php
$wpide_new_customer_to = ''; // Recipient; empty uses the admin email.

add_action( 'woocommerce_created_customer', function ( $customer_id ) use ( $wpide_new_customer_to ) {
    $user = get_userdata( $customer_id );

    if ( ! $user ) {
        return;
    }

    $mailer = WC()->mailer();
    $body   = sprintf(
        '<p>%1$s</p><p><a href="%2$s">%3$s</a></p>',
        esc_html( sprintf( 'A new customer account was created: %1$s (%2$s).', $user->display_name, $user->user_email ) ),
        esc_url( admin_url( 'user-edit.php?user_id=' . $customer_id ) ),
        esc_html( 'View customer' )
    );

    $mailer->send( $wpide_new_customer_to ? $wpide_new_customer_to : get_option( 'admin_email' ), sprintf( '[%s] New customer registered', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ), $mailer->wrap_message( 'New customer', $body ) );
} );
```

## Notes

Set $wpide_new_customer_to to send it to someone other than the site admin.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Email the Shop When a New Customer Registers" 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/
