custom/plugins/ApoShop/src/Resources/views/storefront/component/product/card/badges.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/badges.html.twig' %}
  2. {% block component_product_badges %}
  3.     <div class="product-badges">
  4.         {% block component_product_badges_discount %}
  5.             {% set price = product.calculatedPrice %}
  6.             {% if product.calculatedPrices.count > 0 %}
  7.                 {% set price = product.calculatedPrices.last %}
  8.             {% endif %}
  9.             {% set listPrice = price.listPrice.percentage > 0 %}
  10.             {% set hasRange = product.calculatedPrices.count > 1 %}
  11.             {% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
  12.             {% if displayParent %}
  13.                 {% set displayFromVariants = displayParent and price.unitPrice !== product.calculatedCheapestPrice.unitPrice %}
  14.             {% endif %}
  15.             {% if listPrice and not hasRange and not displayFromVariants %}
  16.                 <div class="badge badge-danger badge-discount">
  17. <span>-{{ product.calculatedPrice.listPrice.percentage|replace({'%': ''})|split('.')[0] }}%</span>
  18.                 </div>
  19.             {% endif %}
  20.         {% endblock %}
  21.     </div>
  22. {% endblock %}