<?php
// Disable both of WooCommmerce included Select2 libraries on the front-end.
add_action( 'wp_enqueue_scripts', function() {
if ( !is_admin() && class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
wp_dequeue_script( 'select2');
wp_deregister_script('select2');
// See: https://developer.woocommerce.com/2017/08/08/selectwoo-an-accessible-replacement-for-select2/
wp_dequeue_script( 'selectWoo');
wp_deregister_script('selectWoo');
}
}, 100 );