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

Discount Info

Outputs one row per currently valid/applied discount for the active cart. Each row includes discount settings data, a formatted discount amount for the current cart context, and entry variables from the discount 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 discount channel entry (for example {title}, {url_title}, and your custom fields).

Most discount settings are available with a discount_ prefix. Example: discount_type, discount_entry_id, discount_member_groups.

discount_type

The classname of the discount plugin in use for this discount.

{discount_type}
Cartthrob_discount_amount_off

discount_amount

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

{discount_amount}
$5.00

Conditionals

{if no_results}

If there are no currently valid discounts, the content inside this conditional is shown.

{if no_results}
    No discounts
{/if}

Behavior and Constraints

Code-backed behavior:

  1. Loads valid discounts from discount_model->get_valid_discounts().
  2. Prefixes returned discount data keys with discount_.
  3. Calculates and formats per-discount amount for current cart context.
  4. Merges discount entry variables into each output row.

Notes:

  • Output is one row per currently valid discount.
  • If no discounts are valid/applied, {if no_results} can be used.
  • Amount values are formatted strings.

Examples

{exp:cartthrob:discount_info}

{if no_results}No discounts are currently active{/if}

Discount Entry Title: {title}
Discount Type: {discount_type}
Discount Amount: {discount_amount}

{/exp:cartthrob:discount_info}