November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Is this current customer logged in? Also how do you create "inMemoryOrderGroup" ?
Yes, it is the current customer who logged in.
The `InMemoryOrderGroup` is created using the current market (`ServiceLocator.Current.GetInstance<ICurrentMarket>().GetCurrentMarket()`) and current currency code (`ServiceLocator.Current.GetInstance<ICurrencyService>().GetCurrentCurrency().CurrencyCode`) then I add lines using the `AddLineItem` method.
Hi Quan,
Thank you for your help. I set the CustomerId value in the InMemoryOrderGroup object and worked! This is the new code:
var inMemoryOrderGroup = new InMemoryOrderGroup(currentMarket, currencyCode);
inMemoryOrderGroup.OrderLink = cart.OrderLink;
inMemoryOrderGroup.CustomerId = cart.CustomerId;
foreach (ILineItem lineItem in cart.GetFirstForm().GetAllLineItems())
{
inMemoryOrderGroup.AddLineItem(lineItem);
}
inMemoryOrderGroup.GetFirstForm().CouponCodes.Add(couponCode);
rewards = ServiceLocator.Current.GetInstance<IPromotionEngine>().Run(inMemoryOrderGroup);
if (rewards.Any())
{
// rewards contain elements
}
Hi there!
I recently migrated to the latest Commerce 14 version and an error started when applying for promotions using the Redemption Limits rules. If there is a value greater than zero in the Per registered user field, the promotion is never applied. It only works for unlimited redemptions.
The following image shows the configuration for a limited promotion:
This is part of the code I am using for evaluating promotions:
Is there something else I need to consider in the new Commerce 14 version to evaluate promotions? (The same code was working in version 12.15)