How to know number of items added to cart in WordPress shopping cart with SHOPP PLUGIN

I’m doing a shopping cart with wordpress using Shopp Plugin.

How can i know the number of items added to cart here.Any code for this.
Can any one please help me.

Related posts

Leave a Reply

3 comments

  1. I added a code to count the number of items in cart and output them.

    Hope it helps!

    <p class="cartinfo">
        <?php if (shopp('cart','hasitems')): ?>
          <?php $total_items = 0; ?>
          <?php while(shopp('cart','items')): ?>
            <?php $total_items = $total_items + 1; ?>
          <?php endwhile; ?>
        <?php echo $total_items;?> <?php if ($total_items = 1) {echo'Item';} else {echo'Items';} ?> (<?php shopp('cart','subtotal'); ?>)
    
        <?php else: ?>
        0 Items in Cart :(
        <?php endif; ?>
        </p>
    
  2. This part has always been a little confusing in Shopp.

    If you need the number of unique items in the cart you should use

    shopp('cart','totalitems','options...');
    

    (for example: 5 apples, 3 pears, 2 carrots would result in 3)

    If you need the number of items in the cart you should use

    shopp('cart','total-quantity','options...');
    

    (for example: 2 apples, 3 pears, 1 carrot would result in 6)

    To use the value in a variable, set options to 'return=true'