woothemes/woocommerce — pull request #1341 by franticpsyx (2012-08-06 12:20:59+00:00)
Title: Added get_cart_contents_count() function and filter hook.

Useful for displaying the number of cart items.

Couldn't find any other 'correct' way to fetch the cart_contents_count property. All themes should use this one instead of directly accessing cart_contents_count.

Currently, when using product bundles, the number of cart items reported when using the value cart_contents_count directly is wrong, because the container item is counted as a separate product.

Depending on the usage scenario (per product pricing or bundle pricing) either the container item or the bundled items should be subtracted from the reported item count.