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 product category (in our example, drinks).
- A cart item filter to count the total number of drinks.
- 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.
- Open the Rule Builder for your campaign.
- Click Add Rules.
- Click Filter Cart Items at the top-right of the page.
- Click Add filter step.
- In Filter & Sort, click Filter items by condition.
- In Condition, select Item category (item) from the palette.
- In the drop-down menu, choose Is equal to.
- Type the desired item category. In our case, we write drinks.
- In Saves as, type the name of the filter. For example, drinksfilter.
- Click Save filter.
You can see the filter in the Cart Item Filters section, over the Rules one. 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.
- In the Cart Item Filters section, click Add filter.
- In the Start with this list of cart items drop-down menu, select drinksfilter.
- Click Counts the number of items in the list.
- In Saves as, type the name of the filter. For example, drinkscount.
- Click Save filter.
You can see the new filter in the Cart Item Filters section, below the previous filter. 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.
- In the Rules section, click Add rule.
- Type a name for your rule. For example, 50% discount for 3+ drinks.
- In Conditions, click Add condition.
- In Attribute, click Validate attribute value.
- Select drinkscount in the palette.
- In the drop-down menu, choose Is greater than or equal to.
- Enter the number of items. In our case, it is 3.
- Click the check mark to the right of the condition to save it.
- In Effects, click Add effect.
- Click Discount individual items.
- In Pick a list of items, select drinksfilter.
- In Discount name, type a suitable name. For example, 50% off.
- Set discount value to ([Item.Quantity]*[Item.Price])*50%.
- Click the check mark to the right of the effect to save it.
- Click Save at the top-right of the page.