Skip to main content

Creating a discount using cart item filters

Let's imagine that we want to issue a discount on a given category of cart items when a certain condition is met. For example, if our business is a bakery, our categories can be drinks, cakes, croissants and bread.

We want to issue a 50% discount on all drinks in the customer's cart when it contains 3 drinks or more. To do it, let's use cart item filters.

In a standard campaign, let's create:

  1. A cart item filter to filter items by item category (in our example, drinks).
  2. A cart item filter to count the total number of drinks.
  3. A promotion rule to issue a discount on all drinks in the cart.

Filtering the cart items by item category

Let's filter the customer's cart by item category to find all the drinks in it. This will allow us to apply more filters and create rules on those items.

Filter items by condition:

  • Attribute is Item category (Item).
  • Is equal to drinks.
  • Save as drinksfilter.

To the right of the filter name, you can see the kind of value assigned to our filter. In this case, it is list of cart items. This means that this filter will be available to be referenced in per-item effects, such as Discount individual items, or other cart item filters.

The following attributes are also created automatically:

  • drinksfilter item count
  • drinksfilter total price

Issuing a discount on the selected items

Let's build a rule to issue a 50% discount on all drinks in the customer's cart when their number is at least 3.

Let's name it 50% discount for 3+ drinks. It has 1 condition and 1 effect.

Condition

Select Check attribute value and compose the following expression:

  • drinksfilter item count Is greater than or equal to 3.

Effect

Discount session total:

  • List of items is drinksfilter.
  • Discount name is 50% off.
  • Discount value is drinksfilter total price * 50%.