{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
{% block page_product_detail_buy_container %}
{{ parent() }}
{% block page_product_detail_buy_container_paypal %}
{% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
{% if buyable %}
{# @var \Swag\PayPal\Checkout\ExpressCheckout\ExpressCheckoutButtonData expressSettings #}
{% set expressSettings = page.extensions[constant('Swag\\PayPal\\Checkout\\ExpressCheckout\\ExpressCheckoutSubscriber::PAYPAL_EXPRESS_CHECKOUT_BUTTON_DATA_EXTENSION_ID')] %}
{% if expressSettings.productDetailEnabled %}
<div class="form-row mt-3 justify-content-end">
<div class="col-8"
data-swag-paypal-express-button="true"
data-swag-pay-pal-express-button-add-line-item-token="{{ sw_csrf('frontend.checkout.line-item.add', {"mode": "token"}) }}"
data-swag-pay-pal-express-button-approve-payment-token="{{ sw_csrf('paypal.approve_payment', {"mode": "token"}) }}"
data-swag-pay-pal-express-button-options="{{ expressSettings|json_encode }}">
</div>
</div>
{% endif %}
{% endif %}
{# @var \Swag\PayPal\Installment\Banner\BannerData installmentBanner #}
{% set installmentBanner = page.extensions[constant('Swag\\PayPal\\Installment\\Banner\\InstallmentBannerSubscriber::PAYPAL_INSTALLMENT_BANNER_DATA_EXTENSION_ID')] %}
{% if installmentBanner is not null %}
<div class="form-row mt-3 mb-4 justify-content-end">
<div class="{{ buyable ? 'col-8' : 'col-12' }}" data-swag-paypal-installment-banner="true"
data-swag-pay-pal-installment-banner-options="{{ installmentBanner|json_encode }}">
</div>
</div>
{% endif %}
{% endblock %}
{% endblock %}