Shopping Cart Item Discount Multiple Products

Rob Jeremy asked on February 27, 2014 06:30

Hi everyone and Kentico dev team.

First I'd like to say the new site is very slick! Awesome work.

I have been tasked with applying a discount to products in the shopping cart, when of a certain type are purchased.

Lets say I have a document type called Product Mugs, of which I have three different products, A, B, and C with a quantity of 1 in my cart.

I would like it so that when a minimum of 3 of this type is purchased, the user would receive a discount of $10.

As I understand the current volume discount solution in Kentico, this could not be accomplished because Volume Discount is for that specific product only.

To achieve this, my ideas have been the following. 1. Setup each product to have a volume discount with a minimum quantity of 1, with the discount price of $3.3333333 2. Create a new info provider class to make the volume discount above only execute when a minimum of 3 different products of that doc type are in the cart

I am struggling with this, because I am not sure what InfoProviderClass to extend. So far I have created a CustomVolumeDiscountInfoProvider class and a ShoppingCartInfoProvider class, with Calculate..Internal() functions, which doesn't seem to help.

At what point in the shopping cart item calculation does the volume discount get executed? Am I going about this the wrong way? I know this is definitely possible with customization, but a little insight would be great.


Recent Answers

Richard Sustek answered on February 28, 2014 04:19


Thank you for your message.

We are glad you like it:) Regarding your issue - the way I would approach it would be to override CalculateTotalDiscount in the ShoppingCartInfoProvider class which you are already exploring. What you need to have is information of all other items places in your shopping cart so I would try to add whole ShoppingCart info to the CalculateTotalDiscount method and once you have all the items you should be able to calculate the price as per your needs.

I hope this will help you in resolving this goal.

Kind regards, Richard Sustek

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.