November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Are you looking for promotions that has been applied to the cart with
promotionEngine.Run(cart)
?
In that case, the promotions that yielded rewards will be stored in the orderform as IOrderForm.PromotionInformation and there you can find an Entries field which has information about which entries and how much was saved per discount.
Correction: it's IOrderForm.Promotions, which is a collection of PromotionInformation.
I am looking for a way of iterating over the items in the cart and read out their respective promotion. An example look for the site would be:
I have managed to get the promotions in a single, encapsulated variable, separated from all the items.
I want to see what promotions are added for each of the items, instead of a collection of promotions added to the cart.
Haven't run this code, but something like this?
var form = cart.GetFirstForm();
var lineItems = cart.GetFirstForm().GetAllLineItems();
foreach (var lineItem in lineItems)
{
var promotions = form.Promotions.Where(promotionInformation => promotionInformation.Entries.Select(promotionEntry => promotionEntry.EntryCode).Contains(lineItem.Code));
// This lineitem has been rewarded the above list of promotions
}
When I'm fetching the calculated discounts/rewards/what say you not, I can't seem to find a way of fetching which items in the cart the afformentioned discounts they are for. And, when I'm trying to use the
I'm always getting a NullReferenceException, but only for entryLinks that is supposed to have a discount associated with it, while the ones without any discount/reward just returns an empty List.
Is there a way of fetching what discounts are for what items in the cart?