{% 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 %}
<div class="product-price-info">
{% block component_product_box_price_unit %}
{% endblock %}
{% block component_product_box_price %}
{% set listPrice = product.priceRange or product.calculatedPrices.count > 0 ? null : product.calculatedPrice.listPrice %}
{% set advancedPricesFlag = product.calculatedPrices.count > 0 %}
{% if product.calculatedPrices.count < 2 %}
{% set advancedPricesFlag = false %}
{% endif %}
{% if listPrice is null and product.calculatedPrices|length == 1 %}
{% set listPrice = product.calculatedPrices|first.listPrice %}
{% endif %}
{% if advancedPricesFlag and listPrice is null %}
{% block component_product_box_block_list_price_wrapper %}
{% set cheapestPrice = product.calculatedPrices|first %}
{% for calcPrice in product.calculatedPrices %}
{% if cheapestPrice.unitPrice > calcPrice.unitPrice %}
{% set cheapestPrice = calcPrice %}
{% endif %}
{% endfor %}
<span class="product-price product-advanced-list-price-wrapper">
{{ cheapestPrice.unitPrice|currency }}
<p class="mwst-box">{{ "inkl. Mwst" }}</p>
</span>
{% endblock %}
{% else %}
<p class="product-price{% if listPrice.percentage > 0 %} with-list-price{% endif %}">
{% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
{{ fromPrice.unitPrice|currency }}
-
{{ listingPrice.to.unitPrice|currency}}
<p class="mwst-box">{{ "inkl. Mwst" }}</p>
{% elseif product.calculatedPrices|length == 1 %}
{{ product.calculatedPrices.first.unitPrice|currency }}
<p class="mwst-box">{{ "inkl. Mwst" }}</p>
{% 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 %}">
{{ listPrice.price|currency }}
<p class="mwst-box">{{ "inkl. Mwst" }}</p>
</span>
{% endif %}
{% else %}
{{ product.calculatedPrice.unitPrice|currency}}
<p class="mwst-box">{{ "inkl. Mwst" }}</p>
{% 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 %}">
</span>
{% endif %}
{% endif %}
</p>
{% endif %}
{% endblock %}
</div>
{% endblock %}