{% 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">
{# @deprecated tag:v6.5.0 - Block page_product_detail_buy_form_inner_csrf will be removed. #}
{% block page_product_detail_buy_form_inner_csrf %}
{{ sw_csrf('frontend.checkout.line-item.add') }}
{% endblock %}
{% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
{% block page_product_detail_buy_container %}
{% if buyable %}
<div class="{{ formRowClass }} buy-widget-container">
{% block page_product_detail_buy_quantity_container %}
<div class="col-4">
{% set selectQuantityThreshold = 100 %}
{% block page_product_detail_buy_quantity %}
{# @deprecated tag:v6.5.0 - Numeric quantity input with additional plus/minus controls will be the default. #}
{% if (product.calculatedMaxPurchase - product.minPurchase) / product.purchaseSteps > selectQuantityThreshold %}
{% block page_product_detail_buy_quantity_input_group %}
<div class="input-group">
{% block page_product_detail_buy_quantity_input %}
<input
type="number"
name="lineItems[{{ product.id }}][quantity]"
class="form-control product-detail-quantity-input"
min="{{ product.minPurchase }}"
max="{{ product.calculatedMaxPurchase }}"
step="{{ product.purchaseSteps }}"
value="{{ product.minPurchase }}"
/>
{% endblock %}
{% block page_product_detail_buy_quantity_input_unit %}
{% if product.translated.packUnit %}
{% if not feature('v6.5.0.0') %}
<div class="input-group-append">
{% endif %}
<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>
{% if not feature('v6.5.0.0') %}
</div>
{% endif %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% else %}
{% block page_product_detail_buy_quantity_select %}
<select name="lineItems[{{ product.id }}][quantity]"
class="{{ formSelectClass }} product-detail-quantity-select">
{% for quantity in range(product.minPurchase, product.calculatedMaxPurchase, product.purchaseSteps) %}
<option value="{{ quantity }}">
{{ quantity }}
{% if quantity == 1 %}
{% if product.translated.packUnit %} {{ product.translated.packUnit }}{% endif %}
{% else %}
{% if product.translated.packUnitPlural %}
{{ product.translated.packUnitPlural }}
{% elseif product.translated.packUnit %}
{{ product.translated.packUnit }}
{% endif %}
{% endif %}
</option>
{% endfor %}
</select>
{% endblock %}
{% endif %}
{% endblock %}
</div>
{% 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="col-8">
{% block page_product_detail_buy_button %}
{# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
{% if feature('v6.5.0.0') %}
<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>
{% else %}
<button class="btn btn-primary btn-block btn-buy"
title="{{ "detail.addProduct"|trans|striptags }}"
aria-label="{{ "detail.addProduct"|trans|striptags }}">
{{ "detail.addProduct"|trans|sw_sanitize }}
</button>
{% endif %}
{% endblock %}
</div>
{% endblock %}
</div>
{% endif %}
{% endblock %}
</form>
{% endblock %}