Posted on 21/05/2015 19:26:42
Hello Vladimir,
First of all, thank you for the help!
The context is the following: The discount is a discount matrix, and it is added to the order, as an orderline, and not to a product orderline.
I'm testing with only one product in the cart.
Now, I tried your suggestion, and it didn't recalculate the cart. First, the property IsCart of the OrderIsPassedToCheckoutHandler order comes with the value of "true".
I've tried to set the AllowOverridePrices property to "true" on each the order and all the orderlines, but that didn't produce any result.
Basicly, what we want is to reproduce the same behaviour as in the edit cart section, where if you update the quantity of the product, it recalculates the discount orderline, or it removes it, if the product is removed from the cart.
I've also tried to subscribe to the Dynamicweb.Notifications.eCommerce.Cart.BeforeShippingMethodIsSet event.
With exactly the same code that I am sending, subscribing to this event, it produces (partly) the result that we want. It removes the orderline with the product, and the discount orderline that was triggered by the product. But, (and here comes the 'partly' part of the result) it still sends me to checkout, despite the absence of any orderline in the cart, billing me only the shipping fee. Here, I need it to trigger the empty cart event.
please check the attachement with the code.
Thank you in advance.