custom/plugins/GrimmTheme/src/Resources/views/storefront/component/customized-products/_include/price-label.html.twig line 1

Open in your IDE?
  1. {# the plugin template cannot be extended because there are no blocks #}
  2. {% if value.relativeSurcharge %}
  3.     {% set productPrice = page.product.calculatedPrices.first.unitPrice %}
  4.     {% if productPrice is null %}
  5.         {% set productPrice = page.product.calculatedPrice.unitPrice %}
  6.     {% endif %}
  7.     {% if context.getTaxState() != 'gross' %}
  8.         {% set productPrice = productPrice - page.product.calculatedTaxes.first.tax %}
  9.     {% endif %}
  10.     {% set valueSurcharge = (value.percentageSurcharge/100) * productPrice %}
  11. {% else %}
  12.     {% set valueSurcharge = value.getCalculatedPrice().totalPrice %}
  13. {% endif %}
  14. {% if valueSurcharge is not null and valueSurcharge != 0 %}
  15.     {% set valueSurchargeInfo = valueSurcharge|currency %}
  16.     {% if brackets %}
  17.         {% set valueSurchargeInfo = '+ ' ~ valueSurchargeInfo %}
  18.     {% endif %}
  19. {% endif %}
  20. {% if valueSurchargeInfo is not null %}
  21.     {% if brackets %} 
  22.         <div class="swag-customized-products-option__price-tag">
  23.             {{ valueSurchargeInfo }}
  24.         </div>
  25.     {% else %} 
  26.         <div class="swag-customized-products-option__price-tag">
  27.             <span class="toggle-icon-plus">
  28.                 {% sw_icon 'plus' style { 'size': 'xs' } %}
  29.             </span>
  30.             <span>
  31.                 {{ valueSurchargeInfo }}
  32.             </span>
  33.         </div>
  34.     {% endif %}
  35. {% endif %}