Buying Groceries
If carry on with your second proposal, would someone buying a box of 12 eggs be shown 12 items? And say someone can buy 250g of flour or 500g of flour. Would this also has to be spelt in the cart summary?
From a user point of view, when one wishes to buy apples one will write:
Rather than:
There is important grouping taking place in people's mind when dealing with shopping lists, and the system should account for this. A shopping list is made of a class of item, its quantity or weight. So the convention is to show the amount of classes, without quantity or weight (in the summary, obviously in the cart template itself this extra information is shown).
Buying Books
However, under particular contexts, this may not apply. For instance, if I'm purchasing books, I'd like to see 4 items even if these are the same book.
So how you should show cart summary really depends on what is being purchased.