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

Cart Discount Percent of Subtotal

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

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_subtotal = (cart->discount() / cart->subtotal()) * 100

Notes:

  • This is an immediate-execution single tag, not a form tag.
  • It reflects the current cart state when the template is rendered.
  • The tag does not add guard logic around this formula; it uses the cart values directly.

Example

{exp:cartthrob:cart_discount_percent_of_subtotal}