Requeue wooSelect scripts to fix checkout select
authorLaury GvR <laury@gaslightmedia.com>
Fri, 20 Jul 2018 16:25:26 +0000 (12:25 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 20 Jul 2018 16:25:26 +0000 (12:25 -0400)
Checkout select boxes use woocommerce scripts for their selection
dropdown animation, but it breaks in the most recent version. This
addition makes sure the scripts are properly loaded, solving the
severe style malfunctions seen on the checkout page.

functions.php
style.css

index 952c833..d7ca586 100644 (file)
@@ -324,10 +324,22 @@ if (!function_exists('loop_columns')) {
     }
 }
 
-
 function murdicks_add_woocommerce_support() {
        add_theme_support( 'woocommerce' );
 }
 add_action( 'after_setup_theme', 'murdicks_add_woocommerce_support' );
 
+// Remove CSS and/or JS for Select2 used by WooCommerce to fix selection boxes styles breaking
+add_action( 'wp_enqueue_scripts', 'woo_requeue_select_scripts', 100 );
+
+function woo_requeue_select_scripts() {
+    if ( class_exists( 'woocommerce' ) ) {
+        wp_dequeue_style( 'selectWoo' );
+        wp_deregister_style( 'selectWoo' );
+    
+        wp_dequeue_script( 'selectWoo');
+        wp_deregister_script('selectWoo');
+    } 
+} 
+
 ?>
index 8ea9830..97d3ece 100644 (file)
--- a/style.css
+++ b/style.css
@@ -3,5 +3,5 @@ Theme Name: murdicksmackinacfudge
 Author: Gaslight Media
 Author URI: http://www.gaslightmedia.com
 Description: A theme for Murdick's Mackinac Fudge
-Version: 1.0.5
+Version: 1.0.6
 */