WooCommerce – Send “New User Registration” email to admins when new customer is created

The following function sends an email notification to all admins when a user is created on WooCommerce.

<?php
/**
* Send "New User Registration" email to admins when new customer is created on WooCommerce.
*
* @param int $id New customer ID.
*/
function my_wc_customer_created_notification( $id ) {
wp_new_user_notification( $id, null, 'admin' );
}
add_action( 'woocommerce_created_customer', 'my_wc_customer_created_notification' );

view raw
plugin.php
hosted with ❤ by GitHub