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

Coupon Info

Outputs one row per coupon code currently applied to the active cart. Each row includes the coupon code itself, the formatted discount amount for that coupon in the current cart context, and entry variables from the coupon channel entry.

See also:

Parameters

This tag has no tag-specific parameters.

Variables

In addition to the variables listed here, this tag also includes entry variables from the coupon code channel entry (for example {title}, {url_title}, and your custom fields).

coupon_code

The coupon code currently being iterated.

50_off

discount_amount

Formatted discount amount contributed by this coupon for the current cart.

{discount_amount}
$5.00

coupon_amount

Alias of discount_amount.

voucher_amount

Alias of discount_amount.

Conditionals

{if no_results}

If there are no coupon codes currently applied, the content inside this conditional is shown.

{if no_results}
No coupon codes
{/if}

Behavior and Constraints

Code-backed behavior:

  1. Reads coupon codes from cart->coupon_codes().
  2. Loads coupon data for each code via coupon_code_model->get(...).
  3. Calculates that coupon’s discount contribution for this cart.
  4. Formats the amount for output and merges coupon entry variables.

Notes:

  • Output is one row per coupon code currently on the cart.
  • If no coupon codes are applied, {if no_results} can be used.
  • Amount variables are formatted strings.

Examples

{exp:cartthrob:coupon_info}

{if no_results}No coupon codes have been submitted{/if}

Coupon Entry Title: {title}
Coupon Code: {coupon_code}
Coupon Discount: {discount_amount}

{/exp:cartthrob:coupon_info}