Created
February 7, 2019 15:51
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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