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.
[EntityIdentifier("LimitedQuantityDollarOffAction")]
Now add your assembly to the rules config builder using ConfigureSitecore
services.Sitecore().Rules((Action)(config => config.Registry((Action)(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 !