src/Storefront/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig line 1
{% block page_product_detail_buy_form_inner %}
{# @var page \Shopware\Storefront\Page\Product\ProductPage #}
{# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
{% set product = page.product %}
<form
id="productDetailPageBuyProductForm"
action="{% block page_product_detail_buy_form_action %}{{ path('frontend.checkout.line-item.add') }}{% endblock %}"
method="post"
class="buy-widget"
data-add-to-cart="true">
{% set DOWNLOAD_STATE = constant('Shopware\\Core\\Content\\Product\\State::IS_DOWNLOAD') %}
{% set showQuantitySelect = not product.states is defined or DOWNLOAD_STATE not in product.states or (DOWNLOAD_STATE in product.states and product.maxPurchase !== 1) %}
{% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
{% block page_product_detail_buy_container %}
{% if buyable %}
<div class="row g-2 buy-widget-container">
{% block page_product_detail_buy_quantity_container %}
{% if showQuantitySelect %}
<div class="col-4 d-flex justify-content-end">
{% set selectQuantityThreshold = 100 %}
{% block page_product_detail_buy_quantity %}
{% block page_product_detail_buy_quantity_input_group %}
<div class="input-group product-detail-quantity-group quantity-selector-group" data-quantity-selector="true">
{% block page_product_detail_buy_quantity_input %}
<button type="button" class="btn btn-outline-light btn-minus js-btn-minus">
{% sw_icon 'minus' style {'size': 'xs'} %}
</button>
<input
type="number"
name="lineItems[{{ product.id }}][quantity]"
class="form-control js-quantity-selector quantity-selector-group-input product-detail-quantity-input"
min="{{ product.minPurchase }}"
max="{{ product.calculatedMaxPurchase }}"
step="{{ product.purchaseSteps }}"
value="{{ product.minPurchase }}"
/>
<button type="button" class="btn btn-outline-light btn-plus js-btn-plus">
{% sw_icon 'plus' style {'size': 'xs'} %}
</button>
{% endblock %}
{% block page_product_detail_buy_quantity_input_unit %}
{% if product.translated.packUnit %}
<span class="input-group-text">
{% if product.minPurchase > 1 and product.translated.packUnitPlural %}
{{ product.translated.packUnitPlural }}
{% elseif product.translated.packUnit %}
{{ product.translated.packUnit }}
{% endif %}
</span>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endblock %}
</div>
{% endif %}
{% endblock %}
{% block page_product_detail_buy_redirect_input %}
{# fallback redirect back to detail page is deactivated via js #}
<input type="hidden"
name="redirectTo"
value="frontend.detail.page">
<input type="hidden"
name="redirectParameters"
data-redirect-parameters="true"
value='{"productId": "{{ product.id }}"}'>
{% endblock %}
{% block page_product_detail_buy_product_buy_info %}
<input type="hidden"
name="lineItems[{{ product.id }}][id]"
value="{{ product.id }}">
<input type="hidden"
name="lineItems[{{ product.id }}][type]"
value="product">
<input type="hidden"
name="lineItems[{{ product.id }}][referencedId]"
value="{{ product.id }}">
<input type="hidden"
name="lineItems[{{ product.id }}][stackable]"
value="1">
<input type="hidden"
name="lineItems[{{ product.id }}][removable]"
value="1">
{% endblock %}
{% block page_product_detail_product_buy_meta %}
<input type="hidden"
name="product-name"
value="{{ product.translated.name }}">
<input type="hidden"
name="brand-name"
value="{{ product.manufacturer.getName() }}">
{% endblock %}
{% block page_product_detail_buy_button_container %}
<div class="{% if showQuantitySelect %}col-8{% else %}col-12{% endif %}">
{% block page_product_detail_buy_button %}
<div class="d-grid">
<button class="btn btn-primary btn-buy"
title="{{ "detail.addProduct"|trans|striptags }}"
aria-label="{{ "detail.addProduct"|trans|striptags }}">
{{ "detail.addProduct"|trans|sw_sanitize }}
</button>
</div>
{% endblock %}
</div>
{% endblock %}
</div>
{% endif %}
{% endblock %}
</form>
{% endblock %}