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

Cart Subtotal Minus Discount

{exp:cartthrob:cart_subtotal_minus_discount} outputs subtotal minus discount.

In this context:

  • base subtotal excludes shipping
  • discount is subtracted from subtotal
  • result is never less than 0

See also:

Parameters

See Global Number Formatting

Modifiers

Use modifiers to control whether tax is included and whether output is formatted.

To get a raw numeric value for subtotal minus discount:

{exp:cartthrob:cart_subtotal_minus_discount:numeric}

To get subtotal with tax, minus discount:

{exp:cartthrob:cart_subtotal_minus_discount:plus_tax}

To get a raw numeric value for subtotal with tax, minus discount:

{exp:cartthrob:cart_subtotal_minus_discount:plus_tax:numeric}

Output and Behavior

  1. Base calculation is max(cart subtotal - cart discount, 0).
  2. :numeric returns that base value without number formatting.
  3. :plus_tax switches the base calculation to max(cart subtotal_with_tax - cart discount, 0).
  4. :plus_tax:numeric returns the plus-tax calculation without number formatting.
  5. Default output is number-formatted using CartThrob number formatting settings.
  6. Shipping is not included by this tag.

Example

Basic subtotal minus discount

{exp:cartthrob:cart_subtotal_minus_discount}

Subtotal with tax minus discount

{exp:cartthrob:cart_subtotal_minus_discount:plus_tax}

Raw numeric value for calculations

{exp:cartthrob:cart_subtotal_minus_discount:plus_tax:numeric}