Discount extensibility allows you to utilize custom attributes as additional discount conditions, giving you more flexibility over how discounts are applied in your implementation.
While configuring customer, B2B, order, or location attributes, you can indicate whether they are enabled for discounts. Then, the attributes can be used to define specific conditions in discount configurations.
Internal Note
If there is a space in the attribute code, it will cause an error when used on a discount.
Use Cases
The following sections describe example scenarios in which discounts may be useful with custom attributes.
B2B and Customer Attributes
B2B and customer attributes can be used as conditions for both line item and order-level discounts. Both types require the shopper to be logged into their account in order to apply the discount, and can be applied in either the cart or checkout. These may be useful in scenarios such as:
- Offering discounts to Harvard alumni based on whether an "alumni" attribute is set to "Harvard."
- Offering discounts to customers using long-term payment plans based on whether a "paymentTermMonths" attribute is set to at least "3".
Order Attributes
Order attributes can only be used as condition for order-level discounts and can be applied in either the cart or checkout. They may be useful in scenarios such as:
- Offering discounts for deliveries based on whether a “deliveryInfo” attribute is not null.
- Offering discounts on orders with completed feedback surveys based on a "feedbackSurvey" attribute set to "true."
Location Attributes
Location attributes can only be used as condition for line item-level discounts and can be applied in either the cart or checkout. They may be useful in scenarios such as:
- Offering discounts for frozen items from locations with a "supportsRefrigeration" attribute set to "true."
- Offering discounts for eCommerce-specific locations based on a "storeType" attribute set to "ecomm."
Enable Attributes for Discounts
You must make the attribute available to discounts in its configurations in order to use it as a discount condition. For more information about creating and configuring attributes in general, see the following documentation:
In the general settings of each attribute type, locate and toggle on the Available for Discounts option and click Save. The below example shows the option for a B2B attribute.
The below example shows the option for a customer attribute.
The below example shows the option for an order attribute.
The below example shows the option for a location attribute.
Create Discounts with Attribute Conditions
Once enabled, you will be able to select the attribute in discount configurations. While configuring a discount:
- Locate the Attribute Conditions section.
- Click Add.
- Select an Attribute Type (B2B, Customer, Order, or Location) from the drop-down menu.
- Select the attribute you want to add from the Attributes drop-down menu.
- Select the Operator Type. The available operators will depend on the attribute's data type.
- If you select a comparison operator, another field will appear where you should enter the value that the attribute should be compared to. For example, you may set the operator type as "greater than" and the value as "2."
- Click Add. This attribute and its selected logic will now be displayed in the Attribute Conditions table.