Created
April 11, 2017 12:24
-
-
Save nczz/6bf0a0f9d5bcb7831815055246cfaed2 to your computer and use it in GitHub Desktop.
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
<?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