WordPress.org

Forums

WooCommerce - excelling eCommerce
Add first/last name to customer-new-account email template (3 posts)

  1. Baden
    Member
    Posted 1 year ago #

    I think this says it to the point. Happy to answer any questions.

    https://wordpress.org/plugins/woocommerce/

  2. chickenbrain
    Member
    Posted 9 months ago #

    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);
    
    ?>
  3. worldsdream
    Member
    Posted 2 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic