Promotions : excluding certain line items from promotions

Vote:
 

Hello everybody, 

I have a requirement on a project I'm working on whereby pricing information for products can be pulled in one of two ways:

  1. Via a list price configured in EPi itself
  2. Via a "special" price that is specific to the currently logged in user of the site, the product sku, and the quantity requested aswell. 
    1. So there is a use whereby if a user has an item in their cart, with a quantity of 2, they may see a different unit price if they changed their quantity. 

The special price in this case is one we have to query via an external service, as the combinations of pricing tiers using the above criteria is so large, that this is not something we can manage via EPiServer itself. 

The idea is that as an authenticated user browses the site they always see the cheapest price from one of the above. 

This above scenario works fine, until we try to accomodate the next requirement

"When a special price is used for a particular line item, no promotions can be applied to that line item". 

This is what I'm having issues with - I've tried the following:

  1. Excluding the items from promotions - https://world.episerver.com/documentation/developer-guides/commerce/marketing/exclude-products-from-promotions/
    • I tried to exclude products by testing if a products cheapest price is the "special" price - this worked fine but then i realised that i needed to cater for quantity requested. So this won't work!
  2. Creating a custom promotion
    • The promotion would enable me to apply the "special" pricing as a discount across the line items that qualify for it as a fixed price
    • Line items that qualify for it would have a custom property added to each of them containing the special price for each
    • The problem I had with this is that the evaluate method in the promotion processor only returns one RewardDescription and the fixed price for each line item would be different in my case - so this won't work either. 

Does anyone else have any options for me?

I've gone down a few different avenues as you can see, but I'm still no closer to a solution for this. 

Thanks very much!

Paul 

#200908
Jan 30, 2019 14:02
Vote:
 

I am not quite sure if i follow what it is you wish to do and the problems you are experiencing.

I would go for a variation of 1. Excluding the items from promotions. with a hint of 2.

  1. Add a custom property on the line items, "ExcludeFromPromotion"/"HasSpecialPrice" or what you like to call it.
  2. Set that custom property on the line item whenever you set/update it's price.
  3. Exclude the lineitems from promotions - if no other way works then by implementing a custom CollectionTargetEvaluator, that checks the custom property, and add it to the StructureMap.
#200920
Jan 30, 2019 16:18
Vote:
 

Hi Erik, 

Thanks for such a quick reply, much appreciated. 

Thats a really good point about the CollectionTargetEvaluator I will give this a go. 

On another note, would there be a way of only applying a promotion if the line item total from that promotion (against the line items list price) would be cheaper than that of the special price were storing on the order line?

Thanks

#200923
Jan 30, 2019 17:30
Vote:
 

You might be able to make it work in a few special cases with a custom promotion but it won't be easy and the requirements have to be just right.

#201024
Feb 01, 2019 16:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.