Add empty option in “Choose your sales agent” dropdown

Sunday, 07 March 2021

WooCommerce B2B Sales Agents has the “Default sales agent” option which allows you to choose a default sales agent to be automatically assigned to all customers who register.
You can set this option to “Allow to choose”, which allows the customer to choose their referral agent during checkout from those available.
If you want to insert an empty option in this drop-down menu, either as a header or as a label, edit functions.php file that you find in your site’s FTP space in:


and insert this code:

add_filter( 'woocommerce_form_field_args', function( $args, $key, $value ) {
    if ( 'wcb2bsa_sales_agent' == $key ) {
        $args['options'] = array_merge(
            array( '' => __( 'Choose your sales agent', 'woocommerce-b2b-sales-agents') ),
    return $args;
}, 10, 3 );
WARNING! Before making any changes, make sure you have made a complete backup of site files and database.
It is advisable not to edit the theme files directly, but to use a child theme.
For more information on child themes, please read: WordPress Official guide on Child Themes