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

Cart Discount

cart_discount outputs the current cart discount total.

If no coupon/discount is active, this typically outputs zero.

See also:

Parameters

This tag has no tag-specific parameters.

Number output formatting follows Global Number Formatting.

Modifiers

:numeric

Return the raw numeric discount value (unformatted).

{exp:cartthrob:cart_discount:numeric}

:minus_tax

Return the discount with the discount-related tax portion removed.

Implementation detail: this is calculated as discount + discount_tax, then formatted.

{exp:cartthrob:cart_discount:minus_tax}

:minus_tax:numeric

Return the same minus_tax result as a raw numeric value.

{exp:cartthrob:cart_discount:minus_tax:numeric}

Behavior and Constraints

  1. Base value comes from ee()->cartthrob->cart->discount().
  2. :minus_tax uses discount + discount_tax.
  3. Modifier order matters: only :minus_tax:numeric returns numeric minus-tax output.
  4. Without :numeric, output is formatted through ee()->number->format().

Example

Basic formatted output:

{exp:cartthrob:cart_discount}

Raw numeric output for calculations:

{exp:cartthrob:cart_discount:numeric}

Note: these examples require an active coupon/discount to show a non-zero discount value.