You can identify if the Cart of the Woocommerce Website has any value or is empty by using this code:

WC()->cart->cart_contents_count == 1

You can insert the code inside the if-condition parameter:

<?php if(WC()->cart->cart_contents_count == 1): ?>
   <!-- True -->
<?php else: ?>
   <!-- False -->
<?php endif; ?>

Leave a Comment

Subscribe to the Newsletter

Subscribe to get my latest content by email. I won't send you spam. Unsubscribe at any time.


Similar Searches:

  • Check if the Cart has item programatically

Related Articles