Developer forum

Forum » Development » Recalculate order on unit change in cart

Recalculate order on unit change in cart

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a project where I have products with different prices depending on the Unit.

In my case, the unit is actually connected to the delivery county (don't ask me why).

The requirement is to display the price and allow users to add to cart only after they select a delivery county. This part is fine.

The problem is in the cart if the user decides to change the delivery county. My first approach would be to not allow this change or if I allow it, I would empty the cart completely.

However, from the usability perspective, it would be better if I would allow them to change the delivery county and I would be able to change the unit of the products that are already in cart and force a cart recalculation.

Is this possible? What would be the best approach to do it?

Thank you,
Adrian


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Adrian,

Couldn't you use one of the CountryChanged notifications in the cart to do this?

- Jeppe

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Jeppe,

I will be very honest. I have not investigated further my options.

If CountryChanged notification would be triggered also on County/Region change, this would be perfect as this is what should trigger a cart recalculation.

Thank you,
Adrian

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

If you need the County/Region as well, then you might be better served with AfterDefaultPropertiesValueIsChanged instead. This one allows you to decide which properties to trigger on.

- Jeppe

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Jeppe,

Thank you very much. I will explore this direction. It sounds very promising.

Thank you,

Adrian

 

You must be logged in to post in the forum