Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add country choices and shipment by country to cart view
Mira Szewczyk234dbdd761fd
diff --git a/saleor/cart/views.py b/saleor/cart/views.pyindex 4469f47a1f..6e20285115 100644--- a/saleor/cart/views.py+++ b/saleor/cart/views.py@@ -9,6 +9,8 @@ from django.template.response import TemplateResponsefrom . import decoratorsfrom ..core.utils import to_local_currencyfrom ..product.models import ProductVariant+from ..shipping.models import COUNTRY_CODE_CHOICES+from ..shipping.utils import assign_shipment_to_countryfrom .forms import ReplaceCartLineFormfrom .models import Cartfrom .utils import check_product_availability_and_warn@@ -32,6 +34,7 @@ def index(request, cart):cart_total = Nonelocal_cart_total = None+ shipment_by_country = assign_shipment_to_country()if cart:cart_total = cart.get_total(discounts=discounts)local_cart_total = to_local_currency(cart_total, request.currency)@@ -41,7 +44,9 @@ def index(request, cart):{'cart_lines': cart_lines,'cart_total': cart_total,- 'local_cart_total': local_cart_total})+ 'local_cart_total': local_cart_total,+ 'country_choices': COUNTRY_CODE_CHOICES,+ 'shipment_by_country': shipment_by_country})@decorators.get_or_empty_db_cart()