Title: Displaying name
Last modified: March 26, 2021

---

# Displaying name

 *  Resolved [saeed khorram del](https://wordpress.org/support/users/khoramdelsaeed20/)
 * (@khoramdelsaeed20)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/)
 * Hi
    When a user register in my website woocommerce shows his username as displaying
   name and this is not suitable for my website I want a code that force woocommerce
   and WordPress to set first name and last name as displaying name
 * Thanks
    -  This topic was modified 5 years, 1 month ago by [saeed khorram del](https://wordpress.org/support/users/khoramdelsaeed20/).

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

 *  [Rashed Ripon (a11n)](https://wordpress.org/support/users/rur165/)
 * (@rur165)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14241414)
 * Hello [@khoramdelsaeed20](https://wordpress.org/support/users/khoramdelsaeed20/),
 * Thanks for reaching out!
 * It looks like this plugin does exactly what you are looking for – [Force First and Last Name as Display Name](https://wordpress.org/plugins/force-first-last/)
 * Since this is not entirely WooCommerce related, you can post on the plugin’s 
   [support forum](https://wordpress.org/support/plugin/force-first-last/), if you
   have further queries.
 * Cheers 🙂
 *  [Rashed Ripon (a11n)](https://wordpress.org/support/users/rur165/)
 * (@rur165)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14269757)
 * Hi there,
 * We’ve not heard back from you in a while, so I’m marking this thread as resolved.
 * Hopefully, you were able to find a solution to your problem! If you have further
   questions, please feel free to open a new topic.
 * Thank you 🙂
 *  Thread Starter [saeed khorram del](https://wordpress.org/support/users/khoramdelsaeed20/)
 * (@khoramdelsaeed20)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14273790)
 * hi
 * this pluging does not work and has many problems
 * please if you can give me a code for this job
 *  [Rashed Ripon (a11n)](https://wordpress.org/support/users/rur165/)
 * (@rur165)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14280032)
 * Hello [@khoramdelsaeed20](https://wordpress.org/support/users/khoramdelsaeed20/),
 * I am sorry to hear that the plugin did not work as expected.
 * Here is a similar discussion with some sample codes – [https://wordpress.stackexchange.com/questions/67444/force-display-name-as-full-name](https://wordpress.stackexchange.com/questions/67444/force-display-name-as-full-name)
 * Please try one of them, I hope you will be able to make it work.
 * I can also recommend the [WooCommerce Developer Resources](https://developer.woocommerce.com/)
   Portal for resources on developing for WooCommerce.
 * You can also visit the [WooCommerce Facebook group](https://www.facebook.com/groups/advanced.woocommerce/)
   or the #developers channel of the [WooCommerce Community Slack](https://woocommerce.com/community-slack/).
   We’re lucky to have a great community of open-source developers for WooCommerce,
   and many of our developers hang out there, as well.
 * If you need a paid solution, you can consider taking help from one of our [partner’s websites](https://woocommerce.com/customizations/).
 * Thank you 🙂
 *  Thread Starter [saeed khorram del](https://wordpress.org/support/users/khoramdelsaeed20/)
 * (@khoramdelsaeed20)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14280843)
 * hi
 * thanks again
 * i found a solution which works correctly , this is the code for those who want
   to use it
 *     ```
       /**
        * New user registrations should have display_name set 
        * to 'firstname lastname'. This is best used on the
        * 'user_register' action.
        *
        * @param int $user_id The user ID
        */
       function set_default_display_name( $user_id ) {
         $user = get_userdata( $user_id );
         $name = sprintf( '%s %s', $user->first_name, $user->last_name );
         $args = array(
           'ID'           => $user_id,
           'display_name' => $name,
           'nickname'     => $name
         );
         wp_update_user( $args );
       }
       add_action( 'user_register', 'set_default_display_name' );
       ```
   
    -  This reply was modified 5 years, 1 month ago by [saeed khorram del](https://wordpress.org/support/users/khoramdelsaeed20/).
 *  [Rashed Ripon (a11n)](https://wordpress.org/support/users/rur165/)
 * (@rur165)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14284443)
 * Awesome!
 * I am glad to know that you have found the solution. I am sure someone else will
   find this useful as well. If you have any other queries, feel free to open a 
   new thread.
 * Thank you 🙂

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

The topic ‘Displaying name’ 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/)

 * 6 replies
 * 2 participants
 * Last reply from: [Rashed Ripon (a11n)](https://wordpress.org/support/users/rur165/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/displaying-name/#post-14284443)
 * Status: resolved