WC_Cart::get_cart_contents_count()
Get number of items in the cart.
Method of the class: WC_Cart{}
Hooks from the method
Return
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 9.4.2
public function get_cart_contents_count() { return apply_filters( 'woocommerce_cart_contents_count', array_sum( wp_list_pluck( $this->get_cart(), 'quantity' ) ) ); }