Skip to content

Commit

Permalink
Disable radiobuttons on product bundles pages (#28)
Browse files Browse the repository at this point in the history
This plugin is not compatible with the product type bundle. Instead of breaking the standard functionality we disable the plugins Javascript if we are on a product page with the type bundle.
  • Loading branch information
JohanDavidsson authored and Mantish committed Nov 5, 2017
1 parent 4a29389 commit d725a54
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wc-variations-radio-buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ public function locate_template( $template, $template_name, $template_path ) {
}

function load_scripts() {
wp_deregister_script( 'wc-add-to-cart-variation' );
wp_register_script( 'wc-add-to-cart-variation', $this->get_plugin_url() . 'assets/js/frontend/add-to-cart-variation.js', array( 'jquery', 'wp-util' ), self::VERSION );
// Don't load JS if current product type is bundle to prevent the page from not working
if (!(wc_get_product() && wc_get_product()->is_type('bundle'))) {
wp_deregister_script( 'wc-add-to-cart-variation' );
wp_register_script( 'wc-add-to-cart-variation', $this->get_plugin_url() . 'assets/js/frontend/add-to-cart-variation.js', array( 'jquery', 'wp-util' ), self::VERSION );
}
}
}

new WC_Radio_Buttons();
}
}

0 comments on commit d725a54

Please sign in to comment.