I want to get the the new registrant first name and display it on my email template:
$firstname = get_user_meta($userid,'first_name',true);
echo '<pre>';
print_r($firstname);
echo '</pre>'
But it is not returning the value. Any ideas?
Thanks
I want to get the the new registrant first name and display it on my email template:
$firstname = get_user_meta($userid,'first_name',true);
echo '<pre>';
print_r($firstname);
echo '</pre>'
But it is not returning the value. Any ideas?
Thanks
The issue was how the user is created and this is my code for creating the user:
$user = wc_create_new_customer($email,$email,$password);
In order to fix that I change the code to:
$new_customer_data = apply_filters( 'woocommerce_new_customer_data', array(
'user_login' => $email,
'user_pass' => $password ,
'first_name' => $firstname ,
'last_name' => $lastname ,
'user_email' =>$email ,
'display_name' => $firstname . ' ' . $lastname ,
'nickname' => $firstname . ' ' . $lastname ,
'role' => 'customer'
) );
$user_id = wp_insert_user( $new_customer_data );