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

Cart Info

{exp:cartthrob:cart_info}...{/exp:cartthrob:cart_info} is a tag pair that exposes cart-level values in one place.

It is useful when you want multiple cart totals/counts in one template block instead of calling many single tags.

See also:

Parameters

This tag has no tag-specific parameters.

cart_info values are prepared from cart global variables. Monetary fields in this tag pair are already formatted using the store/number formatter settings.

If you need custom number formatting control per output, use the individual numeric/format-capable tags instead (for example cart_total, cart_tax).

Variables

In addition to the variables listed here, you may also use any of the Global Tag Variables.

total_items

Total quantity of all items in the cart.

{total_items}
12

total_unique_items

Total number of unique cart rows. This ignores quantity totals.

{total_unique_items}
2

cart_entry_ids

A pipe-delimited list of entry IDs currently in the cart.

{cart_entry_ids}
1|12|123|1234

cart_shipping

Shipping total for the cart.

{cart_shipping}
$13.95

cart_tax_rate

Current store tax rate used in cart calculations.

{cart_tax_rate}
0.07

cart_tax

Cart tax total.

{cart_tax}
$1.95

cart_subtotal

Cart subtotal (item totals before shipping/tax/discount totals are applied).

{cart_subtotal}
$11.95

cart_total

Final cart total (includes tax and shipping, and reflects discounts).

{cart_total}
$13.95

Additional commonly used variables in this tag pair include:

  • cart_discount
  • cart_shipping_plus_tax
  • cart_subtotal_plus_tax
  • cart_weight
  • shipping_option
  • cart_tax_name
  • numeric variants such as cart_total_numeric, cart_tax_numeric, cart_shipping_numeric

Customer and custom-data globals are also available (for example {first_name}, {email_address}, {custom_data:some_key}).

Behavior and Constraints

  1. cart_info is a single-row tag pair (not an item loop).
  2. It parses conditionals using current cart info values.
  3. Values come from cart global variables and cart info data.
  4. Use this tag when you need cart-level totals/counts; use cart_items_info for per-item rows.

Examples

{exp:cartthrob:cart_info}
    {total_items}
    {total_unique_items}
    {cart_entry_ids}
    {cart_shipping}
    {cart_tax_rate}
    {cart_tax}
    {cart_subtotal}
    {cart_total}
{/exp:cartthrob:cart_info}

Conditional example

{exp:cartthrob:cart_info}
    {if total_items > 0}
        Cart total: {cart_total}
    {/if}
{/exp:cartthrob:cart_info}