Skip to content

Instantly share code, notes, and snippets.

@rours
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rours/637b722debac38037766 to your computer and use it in GitHub Desktop.
Save rours/637b722debac38037766 to your computer and use it in GitHub Desktop.
WooCommerce Qty Select - Update Cart Total On Select Change
<?php
/*-----------------------------------------------------------------------------------*/
/* Update cart total on QTY Select change */
/*-----------------------------------------------------------------------------------*/
function cart_select_change_js() {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$(".product-quantity .quantity_select select.qty").change(function(){
$("section.entry .woocommerce").append('<div style="display:none" class="blockUI"></div>');
$("section.entry .woocommerce").append('<div style="z-index: 1000; border: medium none; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; background: url(&quot;/wp-content/plugins/woocommerce/assets/images/ajax-loader@2x.gif&quot;) no-repeat scroll center center / 16px 16px rgb(255, 255, 255); opacity: 0.6; cursor: wait; position: absolute;" class="blockUI blockOverlay"></div>');
$(".actions input.button").click();
});
});
</script>
<?php
}
add_action('woocommerce_after_cart', 'cart_select_change_js', 40);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment