Advertising sustains the DA. Ads are hidden for members. Join today

Discount compatibility

Last updated on
20 November 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Discounts created via the Commerce Discount module provide settings that let you identify which other discounts each discount is compatible with. This lets you create exclusive promotions, for example, where a reduced price takes precedence over any other discount and prevents any other discount from applying to the same product or order.

To understand how discount compatibility works, first ensure you are familiar with the basic settings common to all discounts. As discussed there, disabled discounts are ignored when it comes time to apply discounts. The active discounts are then grouped by discount type and sorted, so Product discounts are applied first in their sort order (alongside other line item based product pricing rules) and Order discounts are applied second (resulting in discount line items being added to the order).

The process for applying each discount to a product line item or order is as follows:

  1. If any discount has been applied to the line item or order already, their compatibility settings are checked to ensure they don't indicate they are incompatible with the discount under consideration. For example, if a product discount has already been applied to a line item that says it is incompatible with any other discount, then no other discount will be applied to the line item even if they would otherwise qualify.
  2. Then the discount's own compatibility settings are checked to ensure they don't indicate they are incompatible with any previously applied discount. For example, if a free shipping order discount indicates it is compatible with any other discount, then it will apply regardless of what other order discounts have already been applied.

Discount compatibility settings are resolved only relative to other discounts of the same type. This means Product discounts only look at other Product discounts on the same line item when determining if they are compatible with each other. Order discounts only look at other Order discounts on the same order.

It also means that Product discounts cannot say they are incompatible with Order discounts. A Product discount that discounts a particular product by $5 will not be able to prevent an Order discount offering free shipping from applying to the order. This is a limitation of the module owing to the different processes used to apply Product discounts to line items vs. Order discounts to orders.

Note: this functionality has been improved in Commerce 2.x, where the core Promotions module incorporates this functionality and applies promotions through a single process. We may improve Commerce Discount over time to backport this functionality to Commerce 1.x, but it is unlikely given the nature of the pricing system.

Help improve this page

Page status: No known problems

You can: