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

Cart Subtotal

{exp:cartthrob:cart_subtotal} outputs the cart subtotal for all cart line items.

In this context, subtotal means:

  • includes item price × quantity totals
  • excludes shipping
  • excludes tax
  • excludes discounts

This makes it a useful pre-tax/pre-shipping amount for cart summaries.

See also:

Parameters

This tag has no tag-specific parameters.

It supports Global Number Formatting options for formatted output.

Modifiers

Use modifiers when you need raw values or tax-inclusive subtotal behavior.

To get a raw numeric value for the cart subtotal:

{exp:cartthrob:cart_subtotal:numeric}

To get the cart subtotal with tax included:

{exp:cartthrob:cart_subtotal:plus_tax}

To get a raw numeric value for the cart subtotal with tax included:

{exp:cartthrob:cart_subtotal:plus_tax:numeric}

Output and Behavior

  1. Default output is number-formatted using CartThrob number formatting settings.
  2. :numeric returns the raw subtotal numeric value (no number formatting).
  3. :plus_tax switches the calculation to subtotal-with-tax.
  4. :plus_tax:numeric returns subtotal-with-tax as a raw numeric value.

Implementation notes:

  • Base subtotal uses the cart subtotal() calculation (sum of item price_subtotal() values).
  • plus_tax uses subtotal_with_tax().
  • Neither mode includes shipping.
  • Base subtotal does not subtract discounts.

Example

Basic subtotal

{exp:cartthrob:cart_subtotal}

Raw value for calculations

{exp:cartthrob:cart_subtotal:numeric}

Subtotal with tax

{exp:cartthrob:cart_subtotal:plus_tax}