I am assigning a manager to an order with the code below. But I do this with manual IDs. What I want to do is "wp_dropdown_users(['role' => 'shop_manager']);" To make a selection with dropdown. How should I go about this.
woocommerce_wp_select( array(
'id' => '_store_manager_id',
'label' => 'Manager:',
'value' => $manager,
'options' => array(
'1' => 'Manager 1',
'2' => 'Manager 2',
'3' => 'Manager 3'
),
'wrapper_class' => 'form-field-wide'
) );
add_action( 'woocommerce_process_shop_order_meta', 'manager_save' );
function manager_save( $order_id ){
update_post_meta( $order_id, '_store_manager_id', wc_clean( $_POST[ '_store_manager_id' ] ) );
// wc_clean() and wc_sanitize_textarea() are WooCommerce sanitization functions
}