Hi @sandippokharel
We have tried the hook “user_registration_after_register_user_action” to run a function after the user is registered, in have created a form with the extra input fields and after the form is submitted the data is stored in the “User Extra Information” i need to get and update the details in the WooCommerce billing information i tried the below function but the function is not triggering after a user is registered.
add_action( ‘user_registration_after_register_user_action’, ‘user_registration_after_email_confirmation’, 10, 2 );
function user_registration_after_email_confirmation( $user_id, $user_reg_successful ) {
// Check if the email confirmation was successful
if ( ! $user_reg_successful ) {
return;
}
// Retrieve the form data from user meta
$address = get_user_meta( $user_id, ‘user_registration_address’, true );
$phone = get_user_meta( $user_id, ‘user_registration_phone’, true );
$country = get_user_meta( $user_id, ‘user_registration_country’, true );
$zip_code = get_user_meta( $user_id, ‘user_registration_zip_code’, true );
// Update WooCommerce billing information
update_user_meta($user_id, ‘billing_address_1’, $address);
update_user_meta($user_id, ‘billing_phone’, $phone);
update_user_meta($user_id, ‘billing_country’, $country);
update_user_meta($user_id, ‘billing_postcode’, $zip_code);
}