{% set product = order_item.variant.product %}

{% form_theme form '@SyliusShop/Form/theme.html.twig' %}

<div class="product-info" id="sylius-product-selecting-variant" {{ sylius_test_html_attribute('product-selecting-variant') }}>
    {{ sylius_template_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item}) }}

    {{ form_start(form, {'action': path('sylius_shop_ajax_cart_add_item', {'productId': product.id}), 'attr': {'id': 'sylius-product-adding-to-cart', 'class': 'loadable', 'novalidate': 'novalidate', 'data-redirect': path('sylius_shop_product_show', {slug: product.slug})}}) }}
    {{ form_errors(form) }}

    <div class="alert alert-danger d-none sylius-validation-error" id="sylius-cart-validation-error" {{ sylius_test_html_attribute('cart-validation-error') }}></div>

    {% if not product.simple %}
        {% if product.variantSelectionMethodChoice %}
            {% include '@SyliusShop/Product/Show/_variants.html.twig' %}
        {% else %}
            {% include '@SyliusShop/Product/Show/_options.html.twig' %}
        {% endif %}
    {% endif %}
    {{ form_row(form.cartItem.quantity, {
        'row_attr' : {
            'class' : 'product-qty'
        },
        'attr' : {
            'class' : 'input-number'
        }
    }) }}

    {{ sylius_template_event('sylius.shop.product.show.add_to_cart_form', {'product': product, 'order_item': order_item}) }}

    <button type="submit" class="btn btn-primary btn-block btn-add-cart" {{ sylius_test_html_attribute('add-to-cart-button') }}>
        <span class="btn-icon-text">{{ 'sylius.ui.add_to_cart'|trans }}</span>
        <span class="btn-icon-svg"><span class="icon-wrapper"></span></span>
    </button>

    {{ form_row(form._token) }}
    {{ form_end(form, {'render_rest': false}) }}
</div>
