I encountered the following bug
Add a product to cart
Apply a coupon code
Remove coupon code
Coupon code is not shown anymore / remove successful
Go in checkout
Continue billing and shipping step
Go back in cart
Coupon code of step #2 is active again
magento magento-1.9
I solved it by event/observer
<events>
<controller_action_predispatch_checkout_cart_couponPost>
<observers>
<remove_session_coupon_code>
<type>singleton</type>
<class>yourmodule/observer</class>
<method>removeCoupon</method>
</remove_session_coupon_code>
</observers>
</controller_action_predispatch_checkout_cart_couponPost>
</events>
public function removeCoupon(Varien_Event_Observer $observer)
{
$controller = $observer->getControllerAction();
if ($controller->getRequest()->getParam('remove') == 1) {
Mage::getSingleton("checkout/session")->unsetData('cart_coupon_code');
}
return $this;
}
No comments:
Post a Comment