Created
August 6, 2020 05:17
-
-
Save balwantmeticulosity/213d8e250b151d2e8c7ef6bc9ce7e573 to your computer and use it in GitHub Desktop.
Woocommerce update minicart
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
| add_filter( 'woocommerce_add_to_cart_fragments', 'wc_refresh_mini_cart_count'); | |
| function wc_refresh_mini_cart_count($fragments){ | |
| ob_start(); | |
| ?> | |
| <span class="cart-no mini-cart-count"> | |
| <?php echo WC()->cart->get_cart_contents_count(); ?> | |
| </span> | |
| <?php | |
| $fragments['.mini-cart-count'] = ob_get_clean(); | |
| return $fragments; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment