Need Assistance on Promotion



If a customer buys a set of items, we would give one item(which is not in that set) free. There is no default Epi promotion to achieve this. Is there any way to customize?

We tried,

"Buy Products for Discount from Other Selection
Buy at least X items from catalog entries and get related catalog entries at a discount. " promotion with 100%.

Thanks in Advance.

Jun 27, 2019 16:13

We ended up writing a custom promotion for that, following the guide:

Look into the implementation for the default "Spend for free items" promotion and any promotion that has a selection for inspiration.

Jun 27, 2019 16:42

Thanks, Erik Norberg,

I implemented a custom promotion. But how can I pass "Limit number of discounted items" value to Promotion Engine? and how to pass dynamic values to "Limit number of discounted items"?

Jun 28, 2019 12:55

I don't follow you, what value is that?

Can you share the code of your implementation?

Jun 28, 2019 15:24

Thanks for your reply.

I use the below code.

protected override RewardDescription Evaluate(EntryPromotion promotionData, PromotionProcessorContext context)
            var lineItems = GetLineItems(context.OrderForm);
            var condition = promotionData.Condition;
            int requiredQuantity = condition.RequiredQuantity;
            var applicableCodes = targetEvaluator.GetApplicableCodes(lineItems, condition.Targets, condition.MatchRecursive);

            //// filter the lineitems based on the required quantity(line item qty should be equal or greater than required quantity).
            var filteredLineItems = GetFilteredLineItems(lineItems, requiredQuantity, condition.MixMatch);

            //// filter the applicable codes based on the filtered lineitems.
            var filteredApplicableCodes = GetFilteredApplicableCodes(applicableCodes, filteredLineItems);

            var fulfillmentStatus = fulfillmentEvaluator.GetStatusForBuyQuantityPromotion(

            return RewardDescription.CreatePercentageReward(
                GetRedemptions(filteredApplicableCodes, promotionData, context, lineItems),

I need   

" Buy Products for Discount from Other Selection
Buy at least X items from catalog entries and get related catalog entries at a discount." promotion.

If user buy A,B,C (3) products,we should apply 10% discount for Product D.If I use this default its working fine.But How can I pass "(Limit number of discounted items)MaxQty" in Evaluate method.Is there any possiblity?

kindly help.

Jun 28, 2019 15:55

Is this a new promotion and no longer the give away from your original post?

For give aways your processor should inherit form the GetFreeItemsProcessorBase

public class YourCustomPromotionProcessor : GetFreeItemsProcessorBase<YourCustomPromotionData>

What does your PromotionData look like?

Jun 28, 2019 16:12

Than you.

I used EntryPromotionProcessorBase.

MyEntryPromotionProcessor : EntryPromotionProcessorBase<MyEntryPromotion>

Can you explain me the Evaluate() method for  GetFreeItemsProcessorBase?.How can I achieve this?

Jun 28, 2019 17:19

Decompiling the source code for GetFreeItemsProcessorBase gives you:

	protected override RewardDescription Evaluate(TEntryPromotion promotionData, PromotionProcessorContext context)
		PurchaseQuantity purchaseQuantity = _conditionGetter(promotionData);
		IList<string> applicableCodes;
		FulfillmentStatus fulfillmentStatus = purchaseQuantity.GetFulfillmentStatus(context.OrderForm, _targetEvaluator, _fulfillmentEvaluator, out applicableCodes);
		if (!fulfillmentStatus.HasFlag(FulfillmentStatus.Fulfilled))
			return NotFulfilledRewardDescription(promotionData, context, fulfillmentStatus);
		context.AddConditionalItems(promotionData.get_ContentLink(), applicableCodes, purchaseQuantity.RequiredQuantity);
		IEnumerable<RedemptionDescription> redemptions = GetRedemptions(promotionData, context, applicableCodes);
		return RewardDescription.CreateFreeItemReward(fulfillmentStatus, redemptions, promotionData, fulfillmentStatus.GetRewardDescriptionText(_localizationService));

Of course you have to replace the PurchaseQuantity condition with your own one to support your use cases.

Jul 01, 2019 15:04

Thanks..Its working fine.

But,For example if I add 5 products to cart and i give purchaseQuantity.RequiredQuantity as 1,discount will  apply for only one  product.But it applied to 5 products.

Edited, Jul 02, 2019 15:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.