update cart logic
This commit is contained in:
@@ -302,6 +302,18 @@ class ProductVariant(models.Model):
|
||||
def __str__(self):
|
||||
return f"{self.product.name} - {', '.join(str(attr) for attr in self.product_attributes.all())}"
|
||||
|
||||
@property
|
||||
def price_before_discount(self):
|
||||
return self.price
|
||||
|
||||
@property
|
||||
def price_after_discount(self):
|
||||
return self.price * (self.discount / 100)
|
||||
|
||||
@property
|
||||
def discount_amount(self):
|
||||
return self.price * (self.discount / 100)
|
||||
|
||||
def set_or_update_price(self, dollor_price=None):
|
||||
if not dollor_price:
|
||||
dollor_object, _ = DollorModel.objects.get_or_create(unique_filed='unique')
|
||||
|
||||
Reference in New Issue
Block a user