we are the theme developers and we are already using the select2 ( http://select2.imtqy.com/ ) script for SELECT boxes in HTML in our wordpress theme. The new WooCommerce 2.3.x, which has just been redesigned, now also uses select2 scripts. But they redefine their styles with their own (primarily important tags) in many ways.
We cannot redefine all our CSS changes with important rules, it will be a lot of CSS mess that we don’t like. Also now our JS script loads 2 times and sometimes conflicts (because woocommerce loads its own select2 js).
My question is the best way to deactivate woocommerce select2 CSS and JS files in our theme functions? We want to use our version of the script and our stylesheet (for woocommerce selections too).
I tried using wp_dequeue_script, wp_deregister_script and the same functions available for styles, but this does not help. As I see it, woocommerce adds scripts / css AFTER our theme has already been initialized and we cannot deactivate it.
Thank.
This is the code downloaded in / includes / class -wc-frontend-scripts.php that I need to disconnect from theme functions:
self::register_script( 'select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.2' );
self::enqueue_script( 'select2' );
wp_enqueue_style( 'select2', $assets_path . 'css/select2.css' );
How to unload these CSS / JS files into theme functions without changing the original WooCommerce files?
source
share