Hi Team,
We are using custom promotions and we get promotion data by using the code below,
var promotions = promotionEngine.Evaluate(contentLink, currentMarket.GetCurrentMarket(), Currency.USD, RequestFulfillmentStatus.PartiallyFulfilled);
In evaluate method, we have customized as follows,
protected override RewardDescription Evaluate(EntryPromotion promotionData, PromotionProcessorContext context)
{
var lineItems = GetLineItems(context.OrderForm);
var condition = promotionData.Condition;
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, condition.RequiredQuantity);
//// filter the applicable codes based on the filtered lineitems.
var filteredApplicableCodes = GetFilteredApplicableCodes(applicableCodes, filteredLineItems);
//// this condition is especially to evaluate variation(to get applicable promotions for variation).
if (applicableCodes.NotNullOrEmpty() && filteredApplicableCodes.IsNullOrEmpty())
{
return RewardDescription.CreatePercentageReward(
FulfillmentStatus.PartiallyFulfilled,
Enumerable.Empty<RedemptionDescription>(),
promotionData,
promotionData.Percentage,
Enum.GetName(typeof(RequestFulfillmentStatus), RequestFulfillmentStatus.PartiallyFulfilled));
}
var fulfillmentStatus = fulfillmentEvaluator.GetStatusForBuyQuantityPromotion(
filteredApplicableCodes,
filteredLineItems,
condition.RequiredQuantity,
condition.RequiredQuantity);
return RewardDescription.CreatePercentageReward(
fulfillmentStatus,
GetRedemptions(filteredApplicableCodes, promotionData, context, lineItems),
promotionData,
promotionData.Percentage,
fulfillmentStatus.GetRewardDescriptionText(localizationService));
}
Its working fine. But, we need promotion based on usergroup.Is there any way to inject metafield into virtually created cart.Kindly help.
Thanks,
Mekala V