Magento – Change the price in cart on the fly

addtocartcart-rulecheckoutevent-observershopping-cart-price-rules

We have 2 observers to change product price in the cart :
checkout_cart_product_add_after to change price the first time the product is added to cart, and checkout_cart_update_items_after to change price for each item in the cart (when user click the "Modify cart" button on cart page). Both are running OK.

My question :
On the cart page, when user clicks the link "Edit" to edit the product in product page (so he can change quantity, …) and clicks the "Update cart" button, this update button does not read any observer to refresh price. Only the quantity is refreshed.

How to force this "Update cart" (on product page) action to process the code in observer? Is there another observer for this? The code in checkout_cart_product_add_after is executed just the first time the product is added to the cart?

Thanks.

Best Answer

You can use checkout_cart_update_item_complete. the event is dispatched in Mage_Checkout_CartController::updateItemOptionsAction the method responsible for updating the cart item.

You get as parameters to the event the cart item, the request made to the action and the response of the action.

Related Topic