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

Discount Settings Fieldtype

The CartThrob Discount Settings fieldtype stores the settings CartThrob uses to apply discounts and coupon codes. Add this fieldtype to your Discounts or Coupons channel, then map that field in Discounts settings.

Field in the Control Panel

Create a channel field using the CartThrob Discount Settings fieldtype. It is typically used on a Discounts channel, a Coupons channel, or both.

After the field exists, go to Discounts settings and select the channel and field CartThrob should use for discounts and coupons.

Fieldtype Settings

This fieldtype does not add custom settings to ExpressionEngine’s field settings screen. Use the standard ExpressionEngine field options to name the field, assign it to the correct channel, and control normal publish-form behavior.

Fieldtype Entry Data

On an entry, the field displays a Type dropdown followed by the settings for the selected discount plugin. Changing the Type shows the settings that apply to that discount type and hides the settings for the other types.

Type

Selects the discount plugin for this discount or coupon entry. The available options come from the installed CartThrob discount plugins.

Plugin Settings

These fields change based on the selected Type. For example, an amount-off discount asks for an amount, while a percentage discount asks for a percentage. Product-specific, category-specific, package, shipping, and quantity-based discounts each add their own relevant fields.

Redeemed By

Stores a pipe-delimited list of member IDs that have used the discount or coupon.

Per User Limit

Limits how many times each customer can use the discount or coupon. Leave it blank for no per-user limit.

Global Limit

Limits how many times the discount or coupon can be used overall. Leave it blank for no global limit.

Limit by Role

Restricts the discount or coupon to specific ExpressionEngine roles. Enter role IDs separated by commas. Leave it blank to allow any role.

Limit by Member ID

Restricts the discount or coupon to specific members. Enter member IDs separated by commas. Leave it blank to allow any member.

Template Tags

Use the field’s short name as a tag pair inside exp:channel:entries to output saved discount settings. The variables available inside the pair are the saved setting short names for the selected discount type, plus the global discount settings.

{exp:channel:entries channel="coupon_codes" url_title="spring-sale"}
    {discount_settings}
        Type: {type}
        Amount off: {amount_off}
        Per-user limit: {per_user_limit}
        Global limit: {discount_limit}
    {/discount_settings}
{/exp:channel:entries}

Common global variables include:

  • type
  • used_by
  • per_user_limit
  • discount_limit
  • member_groups
  • member_ids

Plugin-specific variables depend on the selected discount plugin. For storefront display, most templates should use CartThrob’s discount and coupon tags instead of outputting the raw field data directly.

{discount_settings}
    {if no_results}
        No discount settings were saved for this entry.
    {/if}
{/discount_settings}

See Discounts and Coupons for discount channel setup and Discount Plugins for custom discount plugin development.