Skip to content

Instantly share code, notes, and snippets.

@Willem-Siebe
Last active August 29, 2015 14:04
Show Gist options
  • Save Willem-Siebe/7be8c630c3052f50d895 to your computer and use it in GitHub Desktop.
Save Willem-Siebe/7be8c630c3052f50d895 to your computer and use it in GitHub Desktop.
Overwrite JS of WooCommerce [NOT WORKING] - I copied exact same JS to my own file but it is not working. See: http://stackoverflow.com/a/22648605. Also the approved answer method doesn't work. Dequeque is working, enqueqe not.
// js wijzigen bekijk winkelwagen
add_action( 'wp_enqueue_scripts', 'wsis_remove_woocommerce_add_to_cart_js' );
function wsis_remove_woocommerce_add_to_cart_js() {
wp_dequeue_script('wc-add-to-cart');
}
add_action( 'wp_enqueue_scripts', 'wsis_add_changed_woocommerce_add_to_cart_js', 9 );
function wsis_add_changed_woocommerce_add_to_cart_js() {
wp_enqueue_script( 'wc-add-to-cart', get_stylesheet_directory_uri() . '/js/woocommerce/add-to-cart.js', array( 'jquery' ), WC_VERSION, true );
}
// de laatste false staat in voorbeeld op true omdat deze dan voor de body tag geimplementeerd wordt met behulp van wp_footer template tag, deze is bij mij aanwezig, maar toch werkt dit niet! Als we hem gewoon in de header laden dan werkt het ook niet, ondanks dat de js exact hetzelfde is!
wp_dequeue_script('wc-add-to-cart');
wp_enqueue_script( 'script-theme-2', get_stylesheet_directory_uri() . '/js/woocommerce/add-to-cart.js' , array( 'jquery' ), false, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment