Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add country choices and shipment by country to cart view

Mira Szewczyk234dbdd761fd
diff --git a/saleor/cart/views.py b/saleor/cart/views.py
index 4469f47a1f..6e20285115 100644
--- a/saleor/cart/views.py
+++ b/saleor/cart/views.py
@@ -9,6 +9,8 @@ from django.template.response import TemplateResponse
from . import decorators
from ..core.utils import to_local_currency
from ..product.models import ProductVariant
+from ..shipping.models import COUNTRY_CODE_CHOICES
+from ..shipping.utils import assign_shipment_to_country
from .forms import ReplaceCartLineForm
from .models import Cart
from .utils import check_product_availability_and_warn
@@ -32,6 +34,7 @@ def index(request, cart):
cart_total = None
local_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()