{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
{% 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 %}
{% set addToWishlistOptions = {
productId: product.id,
router: {
add: {
afterLoginPath: path('frontend.wishlist.add.after.login', { productId: product.id }),
path: path('frontend.wishlist.product.add', { productId: product.id }),
token: sw_csrf('frontend.wishlist.product.add', {"mode": "token"})
},
remove: {
path: path('frontend.wishlist.product.remove', { productId: product.id }),
token: sw_csrf('frontend.wishlist.product.remove', {"mode": "token"}),
}
}
} %}
<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">
{% 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 %}
{% set selectQuantityThreshold = 100 %}
<div class="primary_actions {{ formRowClass }} buy-widget-container">
{# <div class="{{ formRowClass }} buy-widget-container">#}
{% block page_product_detail_buy_quantity_container %}
<div class="product_qty">
<div class="block_subtitle">Quantity</div>
{% set selectQuantityThreshold = 100 %}
{% block page_product_detail_buy_quantity %}
{% block page_product_detail_buy_quantity_input_group %}
<div class="qty_block">
{% block page_product_detail_buy_quantity_input %}
<span class="decrease_btn"></span>
<label>
<span class="label">quantity</span>
<input
type="number"
name="lineItems[{{ product.id }}][quantity]"
class="qty_input"
min="{{ product.minPurchase }}"
max="{{ product.calculatedMaxPurchase }}"
step="{{ product.purchaseSteps }}"
value="{{ product.minPurchase }}"
oninput="this.value=this.value.replace(/[^0-9]/g,'');"
maxlength="3"
/>
</label>
<span class="increase_btn"></span>
{% 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 %}
</div>
{% endblock %}
{% endblock %}
{% 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="add_cart_btn">
{% 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') %}
<button class="primary_btn"
title="{{ "detail.addProduct"|trans|striptags }}"
aria-label="{{ "detail.addProduct"|trans|striptags }}">
{# {{ "detail.addProduct"|trans|sw_sanitize }}#}
ADD TO CART
</button>
{% else %}
<button class="primary_btn"
title="{{ "detail.addProduct"|trans|striptags }}"
aria-label="{{ "detail.addProduct"|trans|striptags }}">
{# {{ "detail.addProduct"|trans|sw_sanitize }}#}
ADD TO CART
</button>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{# </div>#}
{% endif %}
{% endblock %}
</div>
</form>
{% if config('core.cart.wishlistEnabled') %}
{% block component_product_wishlist_button %}
<div class="secondary_actions">
<a href="#"
class="add_favorite icon_heart product-wishlist-{{ productId }} product-wishlist-action product-wishlist-not-added product-wishlist-loading"
title="{{ "listing.toggleWishlist"|trans|sw_sanitize }}"
data-add-to-wishlist="true"
data-add-to-wishlist-options="{{ addToWishlistOptions|json_encode }}">add favorite</a>
</div>
{% endblock %}
{% endif %}
{% endblock %}