Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use product from product variant in order
Michał Ociepka21f7ccced0f7
diff --git a/saleor/delivery/__init__.py b/saleor/delivery/__init__.pyindex afd8ed2a01..0487d79cc1 100644--- a/saleor/delivery/__init__.py+++ b/saleor/delivery/__init__.py@@ -32,7 +32,7 @@ class DummyShipping(BaseDelivery):return 'Dummy shipping'def get_delivery_total(self, **kwargs):- weight = sum(line.product.weight for line in self.group)+ weight = sum(line.product.product.weight for line in self.group)qty = sum(line.quantity for line in self.group)return Price(qty * weight,currency=settings.DEFAULT_CURRENCY)diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 26caabfee7..8387a6cce3 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -152,14 +152,14 @@ class DeliveryGroup(Subtyped, ItemSet):def add_items_from_partition(self, partition):for item_line in partition:- product = item_line.product+ product_variant = item_line.productprice = item_line.get_price_per_item()self.items.create(- product=product,+ product=product_variant.product,quantity=item_line.get_quantity(),unit_price_net=price.net,- product_name=smart_text(product),- product_sku=product.sku,+ product_name=smart_text(product_variant),+ product_sku=product_variant.sku,unit_price_gross=price.gross)