Support » Plugin: WooCommerce » select2-customer-user-container

  • Resolved Piani

    (@webbmasterpianise)


    Hi

    Im setting up Woocommerce and have added all my customers. I use their company name, set in “user_login” field, as default sort order and when I handle the customers. I intend to use Woocommerce as my stock tool so I will place manual orders also.

    But when I go to place a manual order (wp-admin/post-new.php?post_type=shop_order) and search for a cutomer in “select2-customer-user-container” it displays the persons (firstname+lastname+Id+email) instead of my “user_login”

    Is there a way to set this field or some code to change the content in this dropdown?

    WordPress: 4.9.4 Woocommerce: 3.3.4

Viewing 2 replies - 1 through 2 (of 2 total)
  • Piani

    (@webbmasterpianise)

    This is on the page “Add new order” (/wp-admin/post-new.php?post_type=shop_order)

    Piani

    (@webbmasterpianise)

    Got an answer on another forum. I use this code:

    
    add_filter('woocommerce_json_search_found_customers', function($customers){
       foreach($customers as $userid=>$title) {
    		$user_info = get_userdata( $userid); 
    		if( $user_info )
    			$customers[$userid] = $user_info->display_name;
       }
       return $customers;
    });
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.