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

Cart Discount Percent of Total

If coupons have been applied to the current cart, this outputs the value of that discount as a percentage of the total.

See also:

Parameters

This tag has no tag-specific parameters.

It supports global numeric output formatting parameters. See Global Number Formatting.

Behavior and Constraints

Code-backed calculation:

cart_discount_percent_of_total = (cart->discount() / cart->total()) * 100

Notes:

  • This is an immediate-execution single tag, not a form tag.
  • Output depends on the current cart totals at render time.
  • cart->total() already includes CartThrob total calculations (subtotal/tax/shipping/discount logic).
  • This tag uses the raw formula above and does not add extra guard logic.

Example

{exp:cartthrob:cart_discount_percent_of_total}