Try our conversational search powered by Generative AI!

Episerver Is there a way to retrieve the original promotion data for the promotion that is applied for a order.


Hi Can we retrive the promotion data that is saved in CMS.

When you use a promotion on a order, and if it is a percentage discount, we want to retrieve the percentage value. Liek 10% or 40%. The PromotionInformation and PromotionInformationEntry has teh dollar amount only.

Oct 11, 2017 22:52

Hm. Good question.

You can check if the applied promotion had the rewardtype "percentage" by looking at PromotionInformation.Percentage. But exactly which percentage that was used at that point in time is probably not accessable. But it's a good point, it should actually be accessible. You can do some tricky workarounds tho:

  • (not recommended) Load the promotion from PromotionInformation.PromotionGuid and read the values from there. If you change the promotion after it was applied the values will be faulty, hence why I don't recommend it.
  • (recommended) Add it yourself in the PromotionInformation.AdditionalInformation. Create your data model and serialize it to JSON and store it by registering an instance of IAdditionalPromotionInformationCreator and implementing the logic in CreateAdditionalInformation. In that you have the AdditionalPromotionInformationContext as a param where you can get the actual promotion (that was being applied, no risk of differences) in AdditionalPromotionInformationContext.PromotionData.
Oct 12, 2017 6:31


What would you use that information for?

Oct 12, 2017 8:07

A use case that comes to mind is the order confirmation mail, where you would want to maybe generate a "-20%" graphic from the promotion to show that you bought it during maybe some exclusive discount period or something like that. Sure, might be covered in the name/description, but if you want to do that use case you would have to extract the % from there or something

Oct 12, 2017 8:11


We are doing some workaround on our end. The work around we have is we calculate the percentage based on SavedAmount against the original price. But our client uses promotions heavily and they combine multiple coupons. And in seom scenarios our workaround breaks. 

Hence we were trying to access the original data.

Storing the promotion actual percentage with the PromotionInformation would be ideal. But for now if am able to retrieve the promotion object with promotion GUID then that would work for now as well. We can make sure the promotion doesn't change once its out there. And it usually doesn't change. We create a new one if needed.

But  in epi 10+ there is no data in promotion  as this is stored on the  CMS side. Are we able to access this data by any means?

We have normal carts. We are using non serialised carts.

Oct 12, 2017 15:35


Our client {Mud pie} has a complex bacckoffice system. They use Aprise and have their own logic of processing the orders. When an order is placed on our epi website we export these orders in text file to their apprise backoffice system.

They have a very complex business rules for this file. And they need the actual percentage value for any promotion used in this file vs the dollar amount that epi saves. So we do need this.

Oct 12, 2017 15:38

Seems to be just 


if that was your question?

Oct 12, 2017 15:42

YEs, that was exactly my question. And I have searched for this so much, but couldn't find anything.

Will try this.

Thank you!

Oct 12, 2017 15:44

Oh sorry! I lied. Actually how do we get the percentage value from this object is the question.

Oct 12, 2017 15:55

When you get back the PromotionData, you can try to cast it to your promotion type, and get the percentage value here.

If you just need the percentage, store it in AdditionalInformation. But that would not be very future proof because you might need to store something else in the future.

There is no easy, nice and future proof way here, unless you can make sure that a promotion is never changed or deleted, but disabled. 

Oct 12, 2017 16:01

Well it can be future proof if you serialize it and manage the data class in C#! You can't really change the properties in the class without migration and you'd need to do checks if it's null or not depending if it's a new property, but somewhat managable future proofiness :P

Oct 12, 2017 16:08


To make sure I understand, we are using epi promotion. Nothing cutomised. Do I still need to cast? Cast it to what object?

What I believe here is I need access to RewardDescription so I can get UnitPercentage Value. But unfortunately this is not acessible. I am right?

Oct 12, 2017 17:25

The object you're getting, PromotionData, is the base class for all promotions in epi. So it won't have anything specific. You need to find out which promotion you're using, including the epi built in, and then cast to that one, make sure it isn't null and get the values from there.

You can find a list of epi promotions in the EPiServer.Commerce.Marketing.Promotions namespace, check

Oct 12, 2017 17:35

Ah Okay! That would be tedious though to check for each promotion type. It can be any promotion.

Will try it to work with that. And also make sure to make it future proof (hopefully)

Thank you both!

Oct 12, 2017 17:58

Here's how you can access promotion data

var promotionInfo = purchaseOrder.GetFirstForm().Promotions.FirstOrDefault();

Dec 08, 2022 22:17
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.