Use Plain Dropdowns Instead of Select2 at Checkout
Removes the Select2 search boxes WooCommerce puts on the country and state fields, using the browser's native dropdowns that are lighter and easier on phones.
Opens WPIDE on
Code
add_action( 'wp_enqueue_scripts', function () {
if ( ! function_exists( 'is_checkout' ) || ! ( is_checkout() || is_account_page() || is_cart() ) ) {
return;
}
wp_dequeue_style( 'select2' );
wp_dequeue_script( 'selectWoo' );
wp_dequeue_script( 'select2' );
}, 100 );
Notes
Country and state fields still update each other, and native dropdowns work better with screen readers and phone keyboards.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.