{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
{% set sppproduct = page.extensions['spp_product'].all()['spp'] %}
{% block page_product_detail_buy_form_inner_csrf %}
{% if config('AmMacTradeCustomPlugins.config.sppProduct') %}
{# {{ parent() }}#}
{% if sppproduct and page.extensions['insurance_warranty'] is not null %}
{{ sw_csrf('frontend.checkoutspp.line-item.add') }}
{% else %}
{{ sw_csrf('frontend.checkout.line-item.add') }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block page_product_detail_buy_form_action %}
{% if config('AmMacTradeCustomPlugins.config.sppProduct') %}
{# {{ parent() }}#}
{% if sppproduct and page.extensions['insurance_warranty'] is not null %}
{{ path('frontend.checkoutspp.line-item.add') }}
{% else %}
{{ path('frontend.checkout.line-item.add') }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block page_product_detail_product_buy_meta %}
{% if config('AmMacTradeCustomPlugins.config.amMacTradeInsuranceWarranty') %}
{{ parent() }}
{% if page.extensions['insurance_warranty'] is not null %}
{% set insurance_prod_id = page.extensions['insurance_warranty'].all()['insurance_prod_id'] %}
<input type="hidden"
name="product-insurance"
class="product-insurance"
value="0">
<input type="hidden"
name="product_insurance_exist"
class="product-insurance-exist"
value="{{ insurance_prod_id }}">
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% if config('AmMacTradeCustomPlugins.config.sppProduct') %}
{% if sppproduct and page.extensions['insurance_warranty'] is not null %}
{# <input type="hidden"#}
{# name="spp_product_id"#}
{# value="{{ sppproduct }}">#}
<input type="hidden"
name="lineItems[{{ sppproduct }}][id]"
value="{{ sppproduct }}">
<input type="hidden"
name="lineItems[{{ sppproduct }}][type]"
value="product">
<input type="hidden"
name="lineItems[{{ sppproduct }}][referencedId]"
value="{{ sppproduct }}">
<input type="hidden"
name="lineItems[{{ sppproduct }}][stackable]"
value="1">
<input type="hidden"
name="lineItems[{{ sppproduct }}][removable]"
value="1">
<input type="hidden"
name="lineItems[{{ sppproduct }}][spp]"
value="1">
<input type="hidden"
name="lineItems[{{ sppproduct }}][sppMain]"
value="{{ page.product.id }}">
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}