# Create 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.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

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](/docs/product/rules/cart-item-filters/overview.md).

In a [standard campaign](/docs/product/campaigns/overview#standard-campaigns), let's
create:

1. A cart item filter to filter items by item category (in our example, drinks).
1. A cart item filter to count the total number of drinks.
1. A [promotion rule](/docs/product/rules/overview.md#promotion-rules) to issue a discount on all
   drinks in the cart.

## Filter 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 conditions**:

- 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:

- <Attribute type="filter" name="drinksfilter item count"/>
- <Attribute type="filter" name="drinksfilter total price"/>

## Issue a discount on the selected items

Let's [build a rule](/docs/product/rules/create-and-manage-rules.md#create-a-promotion-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 one condition and one effect.

### Condition

Select **Check attribute value** and compose the following expression:

{

  
    <Attribute type="filter" name="drinksfilter item count"/> Is greater
    than or equal to <code>3</code>.
  

}

### Effect

**Discount session total**:

- **List of items** is `drinksfilter`.
- **Discount name** is `50% off`.
- **Discount value** is <Attribute type="filter" name="drinksfilter total price"/> ` * 50%`.

## Related pages

- [Manage Application cart item filters][app-cif]
- [Create and manage item bundles](/docs/product/rules/create-and-manage-bundles.md)
- [Discount items in a bundle](/docs/product/tutorials/coupons/bundles.md)

[app-cif]: /docs/product/applications/manage-application-cart-item-filters.md
