Last active
January 3, 2016 02:09
-
-
Save srikat/8393474 to your computer and use it in GitHub Desktop.
WooCommerce: Shortcode for outputting number of products in cart. Usage: [wc_num_items]. Reference: http://docs.woothemes.com/document/show-cart-contents-total/
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_shortcode('wc_num_items', 'function_wc_num_items'); | |
function function_wc_num_items($atts) { | |
global $woocommerce; | |
$cart_contents_count = $woocommerce->cart->cart_contents_count; | |
return $cart_contents_count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment