Skip to content

Instantly share code, notes, and snippets.

@rameshelamathi
Created February 7, 2019 15:51
Show Gist options
  • Save rameshelamathi/79d50b7bbc027bc770c220770d8e6c86 to your computer and use it in GitHub Desktop.
Save rameshelamathi/79d50b7bbc027bc770c220770d8e6c86 to your computer and use it in GitHub Desktop.
Snippet to resolve update cart on quantity change in Avada theme in WooCommerce
function add_woo_discount_rules_custom_script(){
?>
<script>
function click_update_cart_btn(upd_cart_btn) {
var upd_cart_btn = jQuery(".fusion-update-cart");
upd_cart_btn.trigger("click");
}
jQuery(document).ready(function($) {
var update_cart;
jQuery("body").delegate(".cart_item .qty").on("load", function(){
if(update_cart != null){
clearTimeout(update_cart);
}
update_cart = setTimeout(click_update_cart_btn, 1000);
});
});
</script>
<?php
}
add_action('woocommerce_after_cart_table', 'add_woo_discount_rules_custom_script');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment