WordPress at Your Fingertips
function is not described

WC_Cart::get_cart_contents_count() public WC 1.0

Get number of items in the cart.

{} It's a method of the class: WC_Cart{}

Hooks from the method
Return

Int.

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_cart_contents_count();

Code of WC_Cart::get_cart_contents_count() WC 5.6.0

public function get_cart_contents_count() {
	return apply_filters( 'woocommerce_cart_contents_count', array_sum( wp_list_pluck( $this->get_cart(), 'quantity' ) ) );
}