# Set up flash sales

> In flash sale campaigns, a certain number of items are offered at a discount for a limited time. The campaign ends once the time span is over or all the items on sale are sold. We can use coupon code redemptions to limit the number of times the product can be purchased with a discount.

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

Let's imagine that we are a supermarket and want to run a promotion on salami pizzas. We
have a stock of 2500 salami pizzas and we want to sell 2000 of them within a week, from
July 1 to July 7. To do this, we
[create a standard campaign](/docs/product/campaigns/create-and-manage-campaigns.md#create-a-campaign-from-scratch)
to give customers a 40% discount on salami pizzas if they redeem a valid coupon code within
the following week. The campaign will end in a week or when the last salami pizza is sold.

This campaign can be useful to help deplete stocks.

Let's create:

1. A [universal coupon code](/docs/product/campaigns/coupons/create-coupons.md#generate-a-universal-code)
   that we have to distribute among our customers before the start of the campaign.
1. A [cart item filter](/docs/product/rules/cart-item-filters/overview.md) to filter
   items by item category (in our example, salami pizzas), and an additional filter step
   so customers can only purchase one discounted pizza at a time.
1. A [promotion rule](/docs/product/rules/overview.md#promotion-rules) to issue a 40% discount on
   salami pizzas during the first week from the launch of the campaign.

:::note
The [**Coupons** feature](/docs/product/campaigns/settings/manage-campaign-features.md)
has to be enabled.

The **coupon code is valid** condition redeems the code if the rule is successful. The
corresponding counter in
[the **Redemptions** column on the **Coupons** page of the campaign](/docs/product/campaigns/coupons/coupon-page-overview.md#list-coupon-codes-and-gift-cards)
is automatically updated once the session is closed.
:::

## Create a universal coupon code

Let's [create a universal coupon code](/docs/product/campaigns/coupons/create-coupons.md#generate-a-universal-code)
that must be distributed among our customers before July 1. We will use the coupon redemption
limit to ensure that the offer lasts one week and no more than 2000 pizzas are sold with a discount.

- Coupon code: `SalamiPizzaDays2022`
- Coupon redemption limit: `2000`
- Per-customer redemption limit: `Allow unlimited redemptions`
- Schedule: Expiration date on `July 8` at `00:00`

## Filter the cart items by item category and limit the number of items to 1

Let's create a [cart item filter](/docs/product/rules/cart-item-filters/overview.md)
to find all the cart items belonging to the salami pizza category. Let's also add a filter
step to select one item and ensure that customers can only buy one discounted pizza each time
they use the coupon code.

**Filter items by conditions**:

- Attribute is **Item category (Item)**.
- **Is equal to** `salami_pizza`.
- **Add Filter Step**: **Select one item**.
- **Save as** `salami_pizza_filter`.

To the right of the filter name, you can see the kind of value assigned to our filter. In this
case, it is **single Cart Item**. This means that we can use it in the next section in effects
where we discount individual items.

## Issue a 40% discount on salami pizzas

Let's [build a rule](/docs/product/rules/create-and-manage-rules.md#create-a-promotion-rule)
for our customers to receive a 40% discount on a salami pizza in their cart if they redeem
a valid coupon code.

Let's name the rule `Salami pizza - Flash Sales`. It has one condition and one effect.

### Condition

**Coupon code is valid**.

### Effect

**Discount individual items**:

- **List of items** is `salami_pizza_filter`.
- **Discount name** is `40% off per item`.
- **Discount value** is <Attribute name="Item.Price" type="builtin" />`* 40%`.

## Related pages

- [Create a discount using cart item filters](/docs/product/tutorials/coupons/cart-item-filters-discount.md)
- [Use other discount effects](/docs/product/rules/effects/use-effects.md#use-discount-effects)
- [Create a community buying campaign](/docs/product/tutorials/coupons/community-buy.md)
