Use the below snippet to test if a WooCommerce cart is empty.
if ( WC()->cart->get_cart_contents_count() != 0 ) { // cart is not empty } else { // cart is empty }