Created
June 21, 2018 10:44
-
-
Save huytrq/24bc65b8c528f92fbffb876d2ee5b36a to your computer and use it in GitHub Desktop.
Update Custom Cart Count (or any HTML) after AJAX Add to Cart in WooCommerce
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 add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 ); | |
| function iconic_cart_count_fragments( $fragments ) { | |
| $fragments['div.header-cart-count'] = '<div class="header-cart-count">' . WC()->cart->get_cart_contents_count() . '</div>'; | |
| return $fragments; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment