Skip to content

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

Update variants.py

zauddelig2346a588e818
diff --git a/saleor/product/models/variants.py b/saleor/product/models/variants.py
index 3dc9d6a892..fa2f96dfcd 100644
--- a/saleor/product/models/variants.py
+++ b/saleor/product/models/variants.py
@@ -47,11 +47,7 @@ class PhysicalProduct(models.Model):
max_digits=6, decimal_places=2, blank=True, default=0)
depth = models.DecimalField(
max_digits=6, decimal_places=2, blank=True, default=0)
- def get_weight(self):
- try:
- return self.weight
- except AttributeError:
- return self.product.weight
+
class Meta:
abstract = True
app_label = 'product'
@@ -90,7 +86,13 @@ class ProductVariant(models.Model, Item):
modifier = max(discounts)
price += modifier
return price
-
+
+ def get_weight(self):
+ try:
+ return self.weight
+ except AttributeError:
+ return self.product.weight
+
def get_absolute_url(self):
slug = self.product.get_slug()
product_id = self.product.id