CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Total Items Count

{exp:cartthrob:total_items_count} outputs the sum of item quantities in the cart.

Example: if product A has quantity 4 and product B has quantity 5, this returns 9.

If you need the number of unique cart rows instead of quantity totals, use unique_items_count.

Parameters

This tag has no parameters.

Output and Behavior

  1. Returns the cart quantity sum (count_all()).
  2. This is quantity-based, not unique-item-based.
  3. Output is a numeric count.

Examples

{exp:cartthrob:total_items_count}

{if "{exp:cartthrob:total_items_count}" > 0}
    You have items in your cart.
{/if}