I have a need to provide specific customer or visitor groups to the promotion engine when calling Evaluate or GetDiscountedPrices.
The use case is pretty straight forward: a client wants to display two different price on their variant page:
It must be supported that the displayed member price is applied through promotions as well as a direct price on the variant.
When it comes to promotions you can set a different discount campaigns up and use visitor groups to apply discounts that way. Check the personalization section here:
When it comes to ellibility for prices within the price book it gets more tricky... Will have a think about that one.
I think you misunderstood. I know how to apply discounts through visitor groups, but how do you suggest I evaluate that discount for someone that doesn't belong to it?I need to calculate and display the variant price with the member discount on the variant page, even when the active customer doesn't belong to the visitor group "Members".
In technical terms I need some way to supply a visitor group, "Members", to the Evaluate method in the promotion engine, se below. I would guess that today the promotion engine takes the visitor groups to use directly from the current http/customer context.
/// Evaluates the condition on all active promotions, and gives award to specific orders when the conditions are fulfilled.
public interface IPromotionEngine
/// Checks the condition for all active promotions, and gives rewards for the promotions where the condition has been fulfilled.
/// Promotions with higher priority (lower Priority value) will be evaluated first and all excluded promotions will not be evaluated.
/// <param name="orderGroup">The order group which will receive rewards.</param>
/// <param name="settings">The settings for this run of the engine.</param>
/// A list of <see cref="T:EPiServer.Commerce.Marketing.RewardDescription" /> telling whether any promotion was fulfilled,
/// which items the promotion was applied to and to which amount.
IEnumerable<RewardDescription> Run(IOrderGroup orderGroup, PromotionEngineSettings settings);
/// Gets the information about all promotions related to a multiple entries but individually evaluated.
/// <param name="entryLinks">The entries to get the promotion information about.</param>
/// <param name="market">The market.</param>
/// <param name="currency">The currency.</param>
/// <param name="requestFulfillmentStatus">The request fulfillment status.</param>
/// A list of <see cref="T:EPiServer.Commerce.Marketing.RewardDescription" /> giving us the reward information associated to the list of provided <see cref="T:EPiServer.Core.ContentReference" />s.
IEnumerable<RewardDescription> Evaluate(IEnumerable<ContentReference> entryLinks, IMarket market, Currency currency, RequestFulfillmentStatus requestFulfillmentStatus);
Adding a new method to an interface is a breaking change so it will probably not happen. It's more likely/easier to add a property to PromotionEngineSettings. I'll look into that
EDIT Damn, it's Evaluate that needs to change ...