vendor/shopware/storefront/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_buy_form_inner %}
  2.     {# @var page \Shopware\Storefront\Page\Product\ProductPage #}
  3.     {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  4.     {% set product = page.product %}
  5.     <form
  6.         id="productDetailPageBuyProductForm"
  7.         action="{% block page_product_detail_buy_form_action %}{{ path('frontend.checkout.line-item.add') }}{% endblock %}"
  8.         method="post"
  9.         class="buy-widget"
  10.         data-add-to-cart="true">
  11.         {% block page_product_detail_buy_form_inner_csrf %}
  12.             {{ sw_csrf('frontend.checkout.line-item.add') }}
  13.         {% endblock %}
  14.         {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
  15.         {% block page_product_detail_buy_container %}
  16.             {% if buyable %}
  17.                 <div class="form-row buy-widget-container">
  18.                     {% block page_product_detail_buy_quantity_container %}
  19.                         <div class="col-4">
  20.                             {% block page_product_detail_buy_quantity %}
  21.                                 <select name="lineItems[{{ product.id }}][quantity]"
  22.                                         class="custom-select product-detail-quantity-select">
  23.                                     {% for quantity in range(product.minPurchase, product.calculatedMaxPurchase, product.purchaseSteps) %}
  24.                                         <option value="{{ quantity }}">
  25.                                             {{ quantity }}{% if product.packUnit %} {{ product.packUnit }}{% endif %}
  26.                                         </option>
  27.                                     {% endfor %}
  28.                                 </select>
  29.                             {% endblock %}
  30.                         </div>
  31.                     {% endblock %}
  32.                     {% block page_product_detail_buy_redirect_input %}
  33.                         <input type="hidden"
  34.                                name="redirectTo"
  35.                                value="frontend.cart.offcanvas"/>
  36.                     {% endblock %}
  37.                     {% block page_product_detail_buy_product_buy_info %}
  38.                         <input type="hidden"
  39.                                name="lineItems[{{ product.id }}][id]"
  40.                                value="{{ product.id }}">
  41.                         <input type="hidden"
  42.                                name="lineItems[{{ product.id }}][type]"
  43.                                value="product">
  44.                         <input type="hidden"
  45.                                name="lineItems[{{ product.id }}][referencedId]"
  46.                                value="{{ product.id }}">
  47.                         <input type="hidden"
  48.                                name="lineItems[{{ product.id }}][stackable]"
  49.                                value="1">
  50.                         <input type="hidden"
  51.                                name="lineItems[{{ product.id }}][removable]"
  52.                                value="1">
  53.                     {% endblock %}
  54.                     {% block page_product_detail_product_buy_meta %}
  55.                         <input type="hidden"
  56.                                name="product-name"
  57.                                value="{{ product.translated.name }}">
  58.                         <input type="hidden"
  59.                                name="brand-name"
  60.                                value="{{ product.manufacturer.getName() }}">
  61.                     {% endblock %}
  62.                     {% block page_product_detail_buy_button_container %}
  63.                         <div class="col-8">
  64.                             {% block page_product_detail_buy_button %}
  65.                                 <button class="btn btn-primary btn-block btn-buy"
  66.                                         title="{{ "detail.addProduct"|trans|striptags }}"
  67.                                         aria-label="{{ "detail.addProduct"|trans|striptags }}">
  68.                                     {{ "detail.addProduct"|trans|sw_sanitize }}
  69.                                 </button>
  70.                             {% endblock %}
  71.                         </div>
  72.                     {% endblock %}
  73.                 </div>
  74.             {% endif %}
  75.         {% endblock %}
  76.     </form>
  77. {% endblock %}