Forum Replies Created

Viewing 1 replies (of 1 total)
  • By default woocommerce does not add a first name upon creation of the account.

    This was my solution to getting it working if you still need it ??

    add this to functions.php

    add_action('woocommerce_new_customer_data','add_first_name_on_account_creation');
    
    function add_first_name_on_account_creation($new_customer_data){
    		$new_customer_data['first_name'] = isset( $_POST['billing_first_name'] ) ? trim( $_POST['billing_first_name'] ) : '';
    		return $new_customer_data;
    }

    customer-new-account.php

    <?php
    
    $user_email = $user_login;
    $user       = get_user_by('login', $user_login);
    
    $first_name = get_user_meta($user->ID, 'first_name', true);
    
    ?>
Viewing 1 replies (of 1 total)