Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

Promotions [Beta]: Different discount percent for each line item.

$
0
0

I have EPiServer.Commerce 9.19.0 installed (probably promotions are not Beta anymore). I have a requirement to be able to apply different percentage discount for each line item. Basically, I am storing discount % in line item metadata.

Now I created new EntryPromotion and entry promotion processor. In the evaluate method I am loading all line items which has discount % stored in metadata and want to apply those, but when creating RewardDescription there is no way to set discount on each line item - only one value for all line items:

protected override RewardDescription Evaluate(
	AdditionalItemDiscountPromoData promotionData,
	PromotionProcessorContext context)
{
	var orderForm = context.OrderForm;
	var cart = context.OrderGroup as Cart;
	if (cart == null)
	{
		return NoReward(promotionData);
	}
	var lineItems = cart.GetAllLineItems().Where(HasDiscount);
	var priceEntries = new List();
	foreach (var lineItem in lineItems)
	{
		var discount = //

Is there some other way to apply such promotion?


Viewing all articles
Browse latest Browse all 9642

Trending Articles