we are theme developers and we already use select2 (http://select2.github.io/) script for SELECT boxes in HTML in our wordpress theme. New WooCommerce 2.3.x that just relase
Here's a gist that might help or provide a way forward : https://gist.github.com/gregrickaby/2846416
Also have a look at includes/class-wc-frontend-scripts.php
to see how the scripts are being enqueued.
I have copied the code pasted below from the following URL which shows how to dequeue individual styles, which may also help : http://docs.woothemes.com/document/disable-the-default-stylesheet/
// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
I found a solution:
add_action( 'wp_enqueue_scripts', 'mgt_dequeue_stylesandscripts', 100 );
function mgt_dequeue_stylesandscripts() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
wp_dequeue_script( 'select2');
wp_deregister_script('select2');
}
}
There's been some recent changes to WooCommerce (v 3.2.1) in which they forked the select2 script and so the code above by @Dmitry is no longer functional. The new code which worked for me is below..
add_action( 'wp_enqueue_scripts', 'agentwp_dequeue_stylesandscripts', 100 );
function agentwp_dequeue_stylesandscripts() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'selectWoo' );
wp_deregister_style( 'selectWoo' );
wp_dequeue_script( 'selectWoo');
wp_deregister_script('selectWoo');
}
}
For anyone getting a duplication of the select fields. There appears to be an issue due to Woocommerce making a call to:
?wc-ajax=update_order_review
after the page is loaded, which then introduces a select2 element just after each select element:
<span class="select2 select2-container ... >
This span appears under the dropdown and contains the currently chosen option.
Duplicate dropdown element
I tried adding wp_dequeue_script( 'wc-checkout' );
to his code, which did stop the span from appearing, but also stopped other functionality, which was needed.
In the end, I hid the span with css:
.woocommerce-checkout .select2-container {
display:none;
}