Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

Override price used for discount calculation

$
0
0

Version:

Commerce: 13.22.0

CMS: 11.17.0

I am trying to have custom logic determining which price the promotion engine will use when calculating the discount for a promotion. The site has both anonymous B2C users and logged in B2B users.

I have followed Erik Norbergs suggestion of implementing my own IPriceService. I am able to hit my service when calling GetPrices(MarketId market, DateTime validOn, IEnumerable<CatalogKey> catalogKeys, PriceFilter filter) elsewhere in my solution, so my custom service is registered correctly and intercepted as expected.

However, during _promotionEngine.Run I never hit my custom implementation of GetDefaultPrice which I was under the impression would be the price used by the promotion engine.

Currently we have a huge cluttered piece of logic using inmemoryordergroups which I would like to move away from if possible. These are the requirements that I am trying to implement. 

For B2B:

If a promotion does not have coupon code: The discount should be calculated from the list price. (AllCustomer price) I assume this is the standard functionality.

If a promotion has coupon code: The discount should be calculated from the customer specific price.

I want to keep the rest of the promotion engine logic like redemptions, exclusions etc.

For B2C:

Out of the box functionality which works just fine.

Any input is welcome.


Viewing all articles
Browse latest Browse all 8020

Trending Articles