From 47ca7c1dde5e6bac18b19bfccef2b24c8662029d Mon Sep 17 00:00:00 2001 From: phamtyn <45592322+phamtyn@users.noreply.github.com> Date: Tue, 7 May 2019 13:06:19 +0700 Subject: [PATCH] Delete shipping type from the session Delete shipping type from the session when there is no longer discount code. --- cartridge/shop/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cartridge/shop/utils.py b/cartridge/shop/utils.py index ef139a794..73ced21af 100644 --- a/cartridge/shop/utils.py +++ b/cartridge/shop/utils.py @@ -59,6 +59,9 @@ def recalculate_cart(request): if discount_form.is_valid(): discount_form.set_discount() + if not request.session.get("free_shipping"): + settings.clear_cache() + clear_session(request, "shipping_type", "shipping_total") handler = lambda s: import_dotted_path(s) if s else lambda *args: None billship_handler = handler(settings.SHOP_HANDLER_BILLING_SHIPPING) tax_handler = handler(settings.SHOP_HANDLER_TAX)