Created
December 9, 2015 16:47
-
-
Save JohannMG/b0a62a614585006e754c to your computer and use it in GitHub Desktop.
Add a wordpress shortcode that pulls cart count.
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
add_shortcode('cart_count', 'cart_count_sc'); | |
function cart_count_sc ($atts){ | |
$total = WC()->cart->cart_contents_count; | |
return '<span class="cart-count">'. $total . '</span>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment