Skip to content

Instantly share code, notes, and snippets.

@nczz
Created April 11, 2017 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nczz/6bf0a0f9d5bcb7831815055246cfaed2 to your computer and use it in GitHub Desktop.
Save nczz/6bf0a0f9d5bcb7831815055246cfaed2 to your computer and use it in GitHub Desktop.
Woocommerce 自動更新購物車方法
<?php
//functions.php
add_action( 'woocommerce_after_cart', 'mxp_auto_cart_update_qty_script' );
function mxp_auto_cart_update_qty_script() {
?>
<script>
jQuery('div.woocommerce').on('change', '.qty', function(){
jQuery("[name='update_cart']").removeAttr('disabled');
jQuery("[name='update_cart']").trigger("click");
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment