If it is simply the total number, extended according to quantity, then you can use the [nitems] tag.
If you need this number for use in an embedded Perl script, you will need
to set interpolate=1
(or user [[nitems]] in the old parser).
If it is the number of line items you need, then you can use a Perl script:
[perl carts] $#{$Safe{'carts'}->{'main'}} + 1; [/perl]
(The 'main' refers to the main shopping cart.)
If you have SeparateItems in effect, and need the number of unique items, you could use:
[perl] $items = q{[item-list][item-code]|[/item-list]}; @items = split /\|/, $items; $count = 0; for (@items) { $count++ unless $seen{$_}++; } $count; [/perl]