From 8ce1e360f286739faae9278a3d3a02c9b9f03ba5 Mon Sep 17 00:00:00 2001 From: a1iamini Date: Mon, 18 Nov 2024 02:55:19 +0330 Subject: [PATCH] fix(cart): ensure used coupons are removed from session after purchase Resolved an issue where used coupons remained in the user's session after completing a purchase, causing them to be automatically applied in subsequent payments. This fix was implemented in the `clear` method of the cart module. --- Chapter11/myshop/cart/cart.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Chapter11/myshop/cart/cart.py b/Chapter11/myshop/cart/cart.py index a0015c7..0c360c8 100644 --- a/Chapter11/myshop/cart/cart.py +++ b/Chapter11/myshop/cart/cart.py @@ -73,6 +73,8 @@ def remove(self, product): def clear(self): # remove cart from session del self.session[settings.CART_SESSION_ID] + # remove coupon_id from session + del self.session['coupon_id'] self.save() def get_total_price(self):