You can use folloeing code to register you custm status and change it when specific user ordered the product:
function register_awaiting_shipment_order_status() {
register_post_status( 'wc-pendingwholesale', array(
'label' => 'Awaiting shipment',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Awaiting shipment <span class="count">(%s)</span>', 'Awaiting shipment <span class="count">(%s)</span>' ),
) );
}
add_action( 'init', 'register_awaiting_shipment_order_status' );
// Add to list of WC Order statuses
function add_awaiting_shipment_to_order_statuses( $order_statuses ) {
$new_order_statuses = array();
// add new order status after processing
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
$new_order_statuses['wc-pendingwholesale'] = 'Awaiting shipment';
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_awaiting_shipment_to_order_statuses' );
add_action( 'woocommerce_order_status_changed', 'status_changed_processsing_weighted' );
function status_changed_processsing_weighted( $order_id, $checkout = null ) {
global $woocommerce;
$order = new WC_Order( $order_id );
$usermeta = get_user_meta( get_current_user_id() ,'wp_capabilities' ,true );
if ( key( $usermeta ) === 'wholesale_customer' ) {
$order->update_status( 'pendingwholesale', 'order_note' );
}
}