Fix shipping weight calculation
This commit is contained in:
parent
abc4e678ce
commit
2e09c85a92
@ -153,10 +153,13 @@ class Cart:
|
||||
def get_total_price(self):
|
||||
return sum(self.get_item_prices())
|
||||
|
||||
def get_weight_for_all_items(self):
|
||||
for item in self:
|
||||
yield round(Decimal(item['variant'].weight.value) * item['quantity'], 3)
|
||||
|
||||
def get_total_weight(self):
|
||||
if len(self) > 0:
|
||||
for item in self:
|
||||
return item['variant'].weight.value * sum(self.get_all_item_quantities())
|
||||
return sum(self.get_weight_for_all_items())
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user