Sarathlal N

Send notification to administrator on WooCommerce user registration

In WordPress sites, if a new user was registered, the WordPress will send a notification to administrator. But if we are using WooCommerce, user registration will done through process_registration action in WooCommerce. At that time, WordPress never send email notification to admin about new user.

So now we are going to override this functionality by adding a little code snippet to our theme’s / child theme’s functions.php file.

add_action('woocommerce_created_customer', 'admin_email_on_registration', 10 , 1);
function admin_email_on_registration( $customer_id) {
	wp_new_user_notification( $customer_id );
}

The woocommerce_created_customer is a hook which is called during new user registration by WooCommerce. In default, it only sends notification to customers. So we just call the WordPress default new user notification function - wp_new_user_notification() on WooCommerce user registration process to send notification to administrator.

Got a project in mind? Send me a quick message, and I'll get back to you within 24 hours!.

Recent Posts

  1. Disabling Payment Methods in WooCommerce Based on Conditions
  2. How to Update Product Quantity in WooCommerce Using Custom Code
  3. Dynamically Generating a Table of Contents in WordPress
  4. Direct Checkout in WooCommerce - Add Product to Cart from Checkout Page & Skip Shop, Product, and Cart Pages
  5. Understanding the Impact of git reset --hard Command

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.