{% sw_extends '@Storefront/storefront/component/product/card/price-unit.html.twig' %}
{% block component_product_box_price_info %}
{% set purchaseUnit = product.purchaseUnit %}
{% set listingPrice = product.calculatedListingPrice %}
{% set fromPrice = listingPrice.from %}
{% set referncePrice = product.calculatedPrice.referencePrice %}
{% set currencySymbol = page.header.activeCurrency.symbol %}
{% set listPrice = product.calculatedCheapestPrice.listPrice %}
{# {% set listPrice = product.priceRange or product.calculatedPrices.count > 0 ? null : product.calculatedPrice.listPrice %} #}
<div class="product-price-info">
{% block component_product_box_price_unit %}
{# remove #}
{% endblock %}
{% block component_product_box_price %}
<div class="product-price">
{{ product.calculatedCheapestPrice.unitPrice|currency }}
<span class="product-detail-list-price-wrapper">
{% if listPrice.percentage >= 10 %}
{{"listing.beforeListPrice"|trans|trim}}
<span class="line-through" {% if not ("listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0) %}class="list-price-price"{% endif %}>
{{ listPrice.price|number_format(2, ',', '.') }} {{ currencySymbol }}
</span>
*
{{"listing.afterListPrice"|trans|trim}}
<span class="list-price-percentage">{{ "detail.listPricePercentage"|trans({'%price%': listPrice.percentage|round })|sw_sanitize }}</span>
{% endif %}
</div>
{% endblock %}
{# OLD, delete if everything is okay with the new one on top #}
{# {% block component_product_box_price %}
<div class="product-price">
{% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
{{ fromPrice.unitPrice|currency }}
-
{{ listingPrice.to.unitPrice }} {{ currencySymbol }}
{% elseif product.calculatedPrices|length == 1 %}
{{ product.calculatedPrices.first.unitPrice|currency }}
{% else %}
{{ product.calculatedPrice.unitPrice|currency }}
{% if listPrice.percentage > 0 %}
<span class="list-price{% if "listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0 %} list-price-no-line-through{% endif %}">
{{"listing.beforeListPrice"|trans|trim}} <span class="line-through">{{ listPrice.price|currency }}</span> {{ "productBox.priceSave"|trans|sw_sanitize }} {{ listPrice.discount * (-1)|currency }} {{"listing.afterListPrice"|trans|trim}}
</span> #}
{#ToDo
<div class="info end-date">Ends in 20:45:06<span>{% sw_icon 'bell' style { 'pack':'default' } %}</span></div>
<div class="info">Members Only / limit of 1 per member</div>#}
{# {% endif %}
{% endif %}
</div>
{% endblock %} #}
</div>
{% endblock %}