Skip to content

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

Fix product availability logic for discounted products

Artur Smęteaaa330b6f59
diff --git a/saleor/product/utils.py b/saleor/product/utils.py
index 39c80ad05d..2fd9b84d1e 100644
--- a/saleor/product/utils.py
+++ b/saleor/product/utils.py
@@ -35,7 +35,7 @@ def products_with_availability(products, discounts, local_currency):
ProductAvailability = namedtuple(
'ProductAvailability', (
- 'available', 'price_range', 'discount',
+ 'available', 'price_range', 'price_range_undiscounted', 'discount',
'price_range_local_currency', 'discount_local_currency'))
@@ -69,6 +69,7 @@ def get_availability(product, discounts=None, local_currency=None):
return ProductAvailability(
available=is_available,
price_range=price_range,
+ price_range_undiscounted=undiscounted,
discount=discount,
price_range_local_currency=price_range_local,
discount_local_currency=discount_local_currency)
diff --git a/templates/product/details.html b/templates/product/details.html
index f83161b273..2870399499 100644
--- a/templates/product/details.html
+++ b/templates/product/details.html
@@ -37,7 +37,7 @@
<p class="lead" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span class="price">{% price_range availability.price_range %}</span>
{% if availability.discount %}
- <small class="price undiscounted text-muted">{% gross availability.undiscounted_price_range.min_price html=True %}</small>
+ <small class="price undiscounted text-muted">{% gross availability.price_range_undiscounted.min_price html=True %}</small>
{% endif %}
{% if availability.price_range_local_currency %}
<br>