Created
March 8, 2013 04:14
-
-
Save claudiosanches/5114173 to your computer and use it in GitHub Desktop.
Ajax cart.
This file contains hidden or 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 | |
function cs_wc_loop_add_to_cart_scripts() { | |
if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) : ?> | |
<script> | |
jQuery(document).ready(function($) { | |
$(document).on( 'change', '.quantity .qty', function() { | |
$(this).parent('.quantity').next('.add_to_cart_button').attr('data-quantity', $(this).val()); | |
}); | |
}); | |
</script> | |
<?php endif; | |
} | |
add_action( 'wp_head', 'cs_wc_loop_add_to_cart_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment