WC_Cart::get_cart_contents_count
Get number of items in the cart.
Method of the class: WC_Cart{}
Hooks from the method
Returns
Int.
Usage
$WC_Cart = new WC_Cart(); $WC_Cart->get_cart_contents_count();
WC_Cart::get_cart_contents_count() WC Cart::get cart contents count code WC 10.6.2
public function get_cart_contents_count() {
return apply_filters( 'woocommerce_cart_contents_count', array_sum( wp_list_pluck( $this->get_cart(), 'quantity' ) ) );
}