Reputation: 8385
How can I expand the below to handle customer details into the email like a specific name or detail in the email? or even make it load a specific template etc:
add_action('woocommerce_created_customer', 'admin_email_on_registration', 10 , 1);
function admin_email_on_registration( $customer_id) {
wp_new_user_notification( $customer_id );
}
Upvotes: 0
Views: 7190
Reputation: 11808
The actual hook on which you are working is as follows:
do_action( 'woocommerce_created_customer', $customer_id, $new_customer_data, $password_generated );
So little modification in your function like
add_action('woocommerce_created_customer', 'admin_email_on_registration', 10 , 3);
function admin_email_on_registration( $customer_id, $new_customer_data, $password_generated) {
wp_new_user_notification( $customer_id, $new_customer_data, $password_generated );
}
Using the current hook 'woocommerce_created_customer' you can access the following details only.
$new_customer_data
contains 'user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'role' => 'customer'
in an array.
For loading a specific template view wrap_message()
of woocommerce.
Upvotes: 2