For our customization want to get the count of number of products in a cart then use the following code.

global $woocommerce;
$count = $woocommerce->cart->cart_contents_count;
if ($count > 0) 
{
	echo $count;
}
else
{
 echo "No products in cart";
}

Have any doubt, then comment here!

Leave a Reply

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