Title: Add custom field while adding customer
Last modified: October 25, 2019

---

# Add custom field while adding customer

 *  [chandan115](https://wordpress.org/support/users/chandan115/)
 * (@chandan115)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/add-custom-field-while-adding-customer/)
 * Hi,
 * I am adding customer programmatically using wc_create_new_customer function, 
   first name, last name, email is added successfully, but custom fields are not
   adding.
    I have tried two ways 1st one: ` $email= $arr_item->email; $username
   = strstr($arr_item->email, ‘@’, true); $password = wp_generate_password();
 *  $args = array(
    “first_name” => $arr_item->first_name, “billing_first_name” 
   => $arr_item->first_name, “last_name” => $arr_item->last_name, “billing_last_name”
   => $arr_item->last_name, “billing_email” => $arr_item->email, “billing_phone”
   => $arr_item->phone, “agency_name” => $arr_item->agency_name, “billing_company”
   => $arr_item->agency_name, “agency_country” => $arr_item->agency_country, “agency_city”
   => $arr_item->agency_city, “agency_state” => $arr_item->agency_state ); $customer_id
   = wc_create_new_customer( $email, $username, $password, $args );
 * 2nd one
    $customer_id = wc_create_new_customer( $email, $username, $password );
   update_user_meta( $customer_id, ‘agency_name’,$arr_item->agency_name); update_user_meta(
   $customer_id, ‘billing_company’, $arr_item->agency_name); update_user_meta( $
   customer_id, ‘agency_country’, $arr_item->agency_country); update_user_meta( 
   $customer_id, ‘agency_city’, $arr_item->agency_city); update_user_meta( $customer_id,‘
   agency_state’,$arr_item->agency_state);
 * I am trying to add custom field after creating customer using wc_create_new_customer
 * Please help if anyone has any ideas.
 * Thanks in advance
    -  This topic was modified 6 years, 7 months ago by [chandan115](https://wordpress.org/support/users/chandan115/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [wprock](https://wordpress.org/support/users/wprock/)
 * (@wprock)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/add-custom-field-while-adding-customer/#post-12065285)
 * You can do this
 * `update_user_meta( $customer_id, 'YOURCUSTOMFIELDKEY',YOURCUSTOMFIELDDATA);`
 *  Thread Starter [chandan115](https://wordpress.org/support/users/chandan115/)
 * (@chandan115)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/add-custom-field-while-adding-customer/#post-12067295)
 * Thank for your answer.
    I have already tried this one. update_user_meta( $customer_id,‘
   agency_name’,$arr_item->agency_name);
 * I want to save the custom filed on user meta table while creating customer.
 * So that I can access these data using get_user_meta().
 *  Thread Starter [chandan115](https://wordpress.org/support/users/chandan115/)
 * (@chandan115)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/add-custom-field-while-adding-customer/#post-12068302)
 * Hi everyone,
 * I am still facing issue, is there anyone to help me.
    -  This reply was modified 6 years, 7 months ago by [chandan115](https://wordpress.org/support/users/chandan115/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add custom field while adding customer’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [update_user_meta](https://wordpress.org/support/topic-tag/update_user_meta/)
 * [woo commerce](https://wordpress.org/support/topic-tag/woo-commerce/)

 * 3 replies
 * 2 participants
 * Last reply from: [chandan115](https://wordpress.org/support/users/chandan115/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/add-custom-field-while-adding-customer/#post-12068302)
 * Status: not resolved