calc discount

pull/4/head
alexanderroese 2024-06-03 22:04:14 +02:00
parent 6a96625907
commit e48d4da01c
1 changed files with 12 additions and 0 deletions

View File

@ -120,11 +120,23 @@
<span id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}" class="badge badge--bottom-left color-{{ settings.sold_out_badge_color_scheme }}">
{{- 'products.product.sold_out' | t -}}
</span>
{% comment %}
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
<span id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}" class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}">
{{- 'products.product.on_sale' | t -}}
</span>
{%- endif -%}
{% endcomment %}
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
{%- assign discount = card_product.compare_at_price | minus: card_product.price -%}
{%- assign discount_percent = discount | divided_by: card_product.compare_at_price | times: 100 | round -%}
<span id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}" class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}">
{{ discount_percent }}% Rabatt
</span>
{%- endif -%}
</div>
</div>
</div>