Retrieve the promotions/discounts applied on a purchase order.

Dear Team,
Request you to provide me the instructions to retrieve the promotions/discounts applied on a purchase order.

I am using the below code
_promotionEngine.Run(purchaseOrder, new PromotionEngineSettings(RequestFulfillmentStatus.Fulfilled, true))


However I am unable to get the reward information of the expired discounts .

EPiServer Version :10.2

Regards
Venkata Phani kumar R

#179362 Jun 09, 2017 1:50
  • Member since: 2011

    The information of applied discounts are stored in IOrderForm.Promotions. Here you can get the information about the promotions applied and the amounts saved. So if you have an order, just access its .Forms (normally you only have one form so) 

    ((IOrderGroup)purchaseOrder).Forms.First().Promotions

    #179378 Jun 09, 2017 10:15
  • Quan Mai,

    We have custom promotions with custom fields. How can I access the data on these custom fields from the order form like you showed?

    Thanks

    #185112 Nov 09, 2017 17:58
  • Member since: 2016

    Either store it in AdditionalInformation in the PromotionInformation or load the promotion object and read it from there. Downside is that if you load the promotion and read it in real time you can't really use it on purchaseOrders, since they should always have a snapshot of the promotion data that was applied.

    #185113 Nov 09, 2017 18:21
  • Thanks Joel, could you point me in the right direction to load up the promotion object?

    #185114 Nov 09, 2017 18:26
  • Member since: 2016

    Promotions are IContent, just use the content loader to load them from the PromotionInformation.ContentLink :)

    #185115 Nov 09, 2017 18:27
  • Ah, I did not realize that. Thanks!

    #185116 Nov 09, 2017 18:28