Sitecore Experience Commerce Limit Discount by quantity per cart line promotion

A lot of retailers offer promotions to customers and limit it by quantity of an item in cart. Let's say - Take 100$ off each limited to two Laptops. So if you add two laptops to your cart, you get 200$ off, if you add 3 laptops to your cart, you still get 200$ off. If you add 1 laptop to your cart, you get 100$ off. 

This blog post explains how to create a promotion in Sitecore Experience Commerce for the above scenario

High level, here are the steps

1. Create a custom promotion benefit action in Commerce Engine using a plugin

2. Add the content for it in Sitecore XP

3. Open business tools and create the promotion, specify limit quantity and dollar off each.

Create a custom promotion benefit action in Commerce Engine using a plugin

Open your Sitecore Commerce Engine and create a new block. Let's name is LimitedQuantityDollarOffAction


Now add your assembly to the rules config builder using ConfigureSitecore

services.Sitecore().Rules((Action<IRulesConfigBuilder>)(config => config.Registry((Action<IReflectionDiscoveryConfig>)(registry => registry.RegisterAssembly(assembly)))));

Add the content for the promo text in Sitecore

Goto CMS, content editor, Add a new Commerce Term under /sitecore/Commerce/Commerce Control Panel/Commerce Engine Settings/Commerce Terms/BusinessTools/Actions - The name of item MUST be LimitedQuantityDollarOffAction


Open Business Tool and Create a new promo

Simple and fast !