A bit of context: I created a custom promotion adding only a new property (Display name) so that I could display a localized text on my order summary.
Now, when I fetch my promotions applied to my order (order.GetFirstForm().Promotions) I get a list of PromotionInformation
For each PromotionInformation I need to get my new property so that I can display the localized text. I noticed there is an extension EPiServer.Commerce.Marketing.PromotionInformationExtensions.GetPromotion where I can get it, but all methods on this extension are obsolete.
Is there a reason to not use a content loader to get the PromotionData? If so, how could I get my property from a PromotionInformation
(for now I'm using the content loader, I'm jsut curious to know why is it obsolete and if there is a better approach to what I need)
As far as I know, the only and best way to get the promotion data from the PromotionInformation list is to content load it. The obsolete extension method you mentioned do exactly this, no more no less. As to why they are obsolete, I can only speculate.
One pitfall with this is that the promotion behind the reference on the order might be altered or deleted once you content load it. In a utopian world, the promotion data that was applied should be snapshot and stored with the order, but for now only a reference is stored. So keep that in mind when content loading, that they might not be there (especially if you implement something on an order history page, where customers can see old orders).
Gotcha, it makes totally sense.