If you want to get number of items in a WooCommerce cart then you can place the following code in your file.

global $woocommerce;
$count=$woocommerce->cart->cart_contents_count;

Here $count having total number of items in your WooCommerce cart.
Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *