diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-26 16:41:49 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-26 16:41:49 +0700 |
| commit | c0d30564d32210b9edb4c523ca8632e86de0f0a2 (patch) | |
| tree | 2887b3f3fd64d99d49751543a7a739a496427fd3 | |
| parent | dd3f514b17136169779d6fd106b64cda9854ab29 (diff) | |
Update calculate_website_price with flashsale price on get variant API
| -rw-r--r-- | indoteknik_api/models/product_product.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 559f8694..fb485bae 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -84,6 +84,13 @@ class ProductProduct(models.Model): if price[discount_key] > 0: discount_percentage = price[discount_key] if price[price_key] > 0: price_discount = price[price_key] + flashsale = self._get_flashsale_price() + flashsale_price = flashsale['flashsale_price'] + flashsale_discount = flashsale['flashsale_discount'] + if flashsale_price > 0 and flashsale_price < price_discount: + price_discount = flashsale_price + discount_percentage = flashsale_discount + return { 'price': self._get_website_price_exclude_tax(), 'discount_percentage': discount_percentage, |
