How To Remove Select2 in WooCommerce

If you ever find yourself needing to remove Select2 from WooCommerce then follow these simple steps.

Where do I put this code?

A good place for this code is inside your themes functions.php file.  Plugin authors can also adapt this code for use inside their own plugins.

You’ll find the code below for disabling Select2 in WooCommerce version 3.2.1.x and below, as well as version 3.2.1 and above.

/**
 * Remove Select2 for WooCommerce
 */
function wc_disable_select2() {
    if ( class_exists('woocommerce') ) {
        wp_dequeue_style('select2');
        wp_deregister_style('select2');

        // WooCommerce 3.2.1.x and below
        wp_dequeue_script('select2');
        wp_deregister_script('select2');

        // WooCommerce 3.2.1+
        wp_dequeue_script('selectWoo');
        wp_deregister_script('selectWoo');
    } 
}

add_action('wp_enqueue_scripts', 'wc_disable_select2', 100);

How does it work?

Now instead of seeing the Select2 select boxes you will see regular select boxes instead.  Rejoice!  Your mobile users will thank you.