Show percentage of discount in cart (Z#23176955) (#4719)

* Show percentage of discount in cart (Z#23176955)

* Fix computation
This commit is contained in:
Raphael Michel
2025-01-21 16:35:15 +01:00
committed by GitHub
parent 00b4622afa
commit ffdc73e0a3
2 changed files with 22 additions and 4 deletions

View File

@@ -268,8 +268,14 @@
{% if line.discount and line.line_price_gross != line.price %}
<span class="text-success discounted" data-toggle="tooltip" title="{% trans "The price of this product was reduced because of an automatic discount." %}">
<br>
<span class="fa fa-percent fa-fw" aria-hidden="true"></span>
{% trans "Discounted" %}
<span class="fa fa-star fa-fw" aria-hidden="true"></span>
{% if line.price < line.line_price_gross %}
{% blocktranslate trimmed with percent=line.discount_percentage|floatformat:0 %}
{{ percent }} % Discount
{% endblocktranslate %}
{% else %}
{% trans "Discounted" %}
{% endif %}
</span>
{% endif %}
</div>
@@ -335,8 +341,14 @@
{% if line.discount and line.line_price_gross != line.price %}
<span class="text-success discounted" data-toggle="tooltip" title="{% trans "The price of this product was reduced because of an automatic discount." %}">
<br>
<span class="fa fa-percent fa-fw" aria-hidden="true"></span>
{% trans "Discounted" %}
<span class="fa fa-star fa-fw" aria-hidden="true"></span>
{% if line.price < line.line_price_gross %}
{% blocktranslate trimmed with percent=line.discount_percentage|floatformat:0 %}
{{ percent }} % Discount
{% endblocktranslate %}
{% else %}
{% trans "Discounted" %}
{% endif %}
</span>
{% endif %}
</div>