Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Editing the checkout quantities is now able to find the targeted variant
NyanKiyoshi95304fdbc1bf
diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 503d444764..20d478a1f1 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -109,7 +109,8 @@ class Checkout(models.Model):def get_line(self, variant):"""Return a line matching the given variant and data if any."""- matching_lines = (line for line in self if line.variant == variant)+ matching_lines = (+ line for line in self if line.variant.pk == variant.pk)return next(matching_lines, None)def get_last_active_payment(self):diff --git a/saleor/checkout/views/__init__.py b/saleor/checkout/views/__init__.pyindex 11e501385e..a190653e76 100644--- a/saleor/checkout/views/__init__.py+++ b/saleor/checkout/views/__init__.py@@ -166,11 +166,15 @@ def checkout_shipping_options(request, checkout):return TemplateResponse(request, 'checkout/_subtotal_table.html', ctx)-@get_or_empty_db_checkout()+@get_or_empty_db_checkout(+ Checkout.objects.prefetch_related('lines__variant'))def update_checkout_line(request, checkout, variant_id):"""Update the line quantities."""if not request.is_ajax():return redirect('checkout:index')++ checkout = Checkout.objects.prefetch_related(+ 'lines__variant__product__category').get(pk=checkout.pk)variant = get_object_or_404(ProductVariant, pk=variant_id)discounts = request.discountstaxes = request.taxes