Support » Plugin: WooCommerce » Add first/last name to customer-new-account email template

Viewing 2 replies - 1 through 2 (of 2 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);
    
    ?>

    Do you know how to add last name to it?

    So we have first+ last name on new account creation?

    edit: I did try the code, it’s not working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add first/last name to customer-new-account email template’ is closed to new replies.