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.

Let's create:

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

Filtering the cart items by product category

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

  1. Open the Rule Builder for your campaign.
  2. Click Add Rules.
  3. Click Filter Cart Items at the top-right of the page.
  4. Click Add Filter Step.
  5. In Filter & Sort, click Filter items by condition.
  6. In Condition, select Item category (item) from the palette.
  7. In the drop-down menu, choose Is equal to.
  8. Type the desired item category. In our case, we write drinks.
  9. In Saves as, type the name of the filter. For example, drinksfilter.
  10. Click Save Filter.

You can see the filter in the Cart Item Filters section, over the Rules one.

tip

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 wherever other lists, such as the list of cart items, are available.

Counting the number of drinks in the cart

Let's create a second cart item filter to know the total number of drinks in the cart. This will allow us to create rules using that information.

Let's use filter shortcuts to make the cart item filter creation process easier:

  1. In the Cart Item Filters section, click Filter shortcuts to the right of the drinksfilter filter.
  2. Click Add item count filter in the drop-down menu.You can see the new filter in the Cart Item Filters section, below the previous filter. It is called drinksfilter_count.
tip

To the right of the filter name, you can see the kind of value assigned to this filter: number. This means that we can use it in arithmetic conditions in the next section.

Issuing a discount on the selected items

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

  1. In the Rules section, click Add rule.
  2. Type a name for the rule. For example, 50% discount for 3+ drinks.
  3. In Conditions, click Add condition.
  4. In Attribute, click Validate attribute value.
  5. Select drinksfilter_count in the palette.
  6. In the drop-down menu, choose Is greater than or equal to.
  7. Enter the number of items. In our case, it is 3.
  8. Click Done.
  9. In Effects, click Add effect.
  10. Click Discount individual items.
  11. In Pick a list of items, select drinksfilter.
  12. In Discount name, type a suitable name. For example, 50% off.
  13. Set Discount value to ([Item.Quantity]*[Item.Price])*50%.
  14. Click Done.
  15. Click Save at the top-right of the page.