Skip to content

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

Update variants.py

zauddeligac31894ed101
diff --git a/saleor/product/models/variants.py b/saleor/product/models/variants.py
index fa2f96dfcd..7cde8634de 100644
--- a/saleor/product/models/variants.py
+++ b/saleor/product/models/variants.py
@@ -47,6 +47,12 @@ 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