diff --git a/Config/module.xml b/Config/module.xml index 4ae8924..fc3c23b 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -19,7 +19,7 @@ en_US fr_FR - 2.2.18 + 2.2.19 Vincent Lopes-Vicente diff --git a/Controller/Front/CouponController.php b/Controller/Front/CouponController.php index efcb3f8..d5ef1e4 100644 --- a/Controller/Front/CouponController.php +++ b/Controller/Front/CouponController.php @@ -16,6 +16,7 @@ use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponManager; use Thelia\Exception\UnmatchableConditionException; use Thelia\Model\CouponQuery; @@ -160,6 +161,7 @@ public function clearCoupon( EventDispatcherInterface $dispatcher, ModelFactory $modelFactory, Session $session, + CouponManager $couponManager, $id ) { $cart = $session->getSessionCart($dispatcher); @@ -176,6 +178,19 @@ public function clearCoupon( unset($consumedCoupons[$coupon->getCode()]); $session->setConsumedCoupons($consumedCoupons); + + + $discount = $couponManager->getDiscount(); + + $session + ->getSessionCart($dispatcher) + ->setDiscount($discount) + ->save(); + + $session + ->getOrder() + ->setDiscount($discount); + } catch (Exception $e) { throw new Exception(Translator::getInstance()->trans('An error occurred while clearing coupon ' . $id . ' : ') . $e->getMessage()); }