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.
- A cart item filter to filter items by item category (in our example, drinks).
- A cart item filter to count the total number of drinks.
- 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
- Save as
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: Add item count filter on the drinksfilter filter.
You can see the new filter in the Cart Item Filters section, below the previous
filter. It is called
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 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.
Validate attribute value:
- Cart item filter is drinksfilter_count.
- Is greater than or equal to
Discount individual items:
- List of items is
- Discount name is
50% off per item.
- Discount value is