Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use CountryForm in cart view to choose information about delivery prices
Mira Szewczyk41067a2486dd
diff --git a/saleor/cart/views.py b/saleor/cart/views.pyindex 6e20285115..ae3e6c826c 100644--- a/saleor/cart/views.py+++ b/saleor/cart/views.py@@ -7,11 +7,10 @@ from django.shortcuts import get_object_or_404, redirect, renderfrom django.template.response import TemplateResponsefrom . import decorators-from ..core.utils import to_local_currency+from ..core.utils import to_local_currency, get_default_countryfrom ..product.models import ProductVariant-from ..shipping.models import COUNTRY_CODE_CHOICESfrom ..shipping.utils import assign_shipment_to_country-from .forms import ReplaceCartLineForm+from .forms import ReplaceCartLineForm, CountryFormfrom .models import Cartfrom .utils import check_product_availability_and_warn@@ -39,13 +38,17 @@ def index(request, cart):cart_total = cart.get_total(discounts=discounts)local_cart_total = to_local_currency(cart_total, request.currency)+ default_country = get_default_country(request)+ country_form = CountryForm(request.POST or None,+ initial={'country': default_country})+return TemplateResponse(request, 'cart/index.html',{'cart_lines': cart_lines,'cart_total': cart_total,'local_cart_total': local_cart_total,- 'country_choices': COUNTRY_CODE_CHOICES,+ 'country_form': country_form,'shipment_by_country': shipment_by_country})