Try our conversational search powered by Generative AI!

Evaluate prices for specific customer or visitor groups

Vote:
 

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:

  1. The actual price the customer has to pay for the variant.
  2. The member price that the customer would get if they were a member (hidden if they already are a member).

It must be supported that the displayed member price is applied through promotions as well as a direct price on the variant.

#207165
Sep 11, 2019 16:47
Vote:
 

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:

https://webhelp.episerver.com/latest/en/commerce/marketing/campaignsnew.htm

When it comes to ellibility for prices within the price book it gets more tricky... Will have a think about that one.

#207170
Sep 11, 2019 18:14
Vote:
 

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".

#207231
Sep 13, 2019 15:08
Vote:
 

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.

// EPiServer.Commerce.Marketing.IPromotionEngine

/// <summary>
/// Evaluates the condition on all active promotions, and gives award to specific orders when the conditions are fulfilled.
/// </summary>
public interface IPromotionEngine
{
	/// <summary>
	/// 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.
	/// </summary>
	/// <param name="orderGroup">The order group which will receive rewards.</param>
	/// <param name="settings">The settings for this run of the engine.</param>
	/// <returns>
	/// 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.
	/// </returns>
	IEnumerable<RewardDescription> Run(IOrderGroup orderGroup, PromotionEngineSettings settings);

	/// <summary>
	/// Gets the information about all promotions related to a multiple entries but individually evaluated.
	/// </summary>
	/// <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>
	/// <returns>
	/// 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.
	/// </returns>
	IEnumerable<RewardDescription> Evaluate(IEnumerable<ContentReference> entryLinks, IMarket market, Currency currency, RequestFulfillmentStatus requestFulfillmentStatus);
}
#207232
Sep 13, 2019 15:21
Vote:
 

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 ... 

#207233
Edited, Sep 13, 2019 16:35
Vote:
 

Guess why i wrote "some way" to provide it? :P

I guess in the end it is Run that has the logic that needs to do the actual work and if we can get that to support the use case, through PromotionEngineSettings or otherwise, then it will atleast be possible.

(I can create my own InMemoryOrderGroup and call Run with, but I really don't want to write my own promotion engine. ;-))

#207278
Edited, Sep 16, 2019 15:36
This thread is locked and should be used for reference only.
* 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.