Skip to Content
Former Member
Sep 05, 2014 at 08:43 AM

Override the addToCart price



We need custom logic for the addToCart price, we have several price rows with an additional field, based on that field we know which price row we should use. However Hybris doesn't understand this custom logic, so we need to override it. But how can we override the addToCart price?

I already tried to override the class CommercePriceService with their methods getPriceFromProduct() and getWebPriceFromProduct() and that has influence on the base price, but it hasn't any influence on the addToCart price.

How should we handle this?

Thanks in advance.

Edit: I found the page where is explained that you can hook the addToCart mechanism. Ofcourse I could add this and call the afterAddToCart method to recalculate the prices. Is this the best way to solve this issue?

Edit2: Someone mentioned that I should override (and extend) the Europe1PriceFactory and than only override the method 'matchPriceRowsForInfo' and that should be enough. Is this the best solution to solve this?