Files
wc-bootstrap/templates/single-product/back-in-stock-form.html.twig

66 lines
2.7 KiB
Twig
Raw Normal View History

{#
# Back in Stock Form (Bootstrap 5 Override)
#
# Notification signup form shown on out-of-stock product pages.
#
# Expected context:
# product_id - Product ID
# is_visible - Whether the form is visible (not hidden)
# show_email_field - Whether to show the email input
# show_checkbox - Whether to show the privacy opt-in checkbox
# button_class - CSS class for the submit button
#
# WooCommerce PHP equivalent: single-product/back-in-stock-form.php
#
# @package WcBootstrap
# @since 0.1.0
#}
<div class="wc_bis_form card{% if not is_visible %} d-none{% endif %} mt-3"
data-bis-product-id="{{ product_id }}">
<div class="card-body">
<h3 id="wc_bis_form_heading_{{ product_id }}" class="h6 mb-3">
{{ __('Want to be notified when this product is back in stock?') }}
</h3>
<form method="post" novalidate aria-labelledby="wc_bis_form_heading_{{ product_id }}">
<div class="d-flex gap-2 mb-3">
{% if show_email_field %}
<label for="wc_bis_email_{{ product_id }}" class="visually-hidden">
{{ __('Email address to be notified when this product is back in stock') }}
</label>
<input type="email"
name="wc_bis_email"
class="form-control"
placeholder="{{ __('Enter your e-mail') }}"
id="wc_bis_email_{{ product_id }}"
required
aria-required="true" />
{% endif %}
<button type="submit"
name="wc_bis_register"
class="btn btn-primary flex-shrink-0">
<i class="bi bi-bell me-1" aria-hidden="true"></i>
{{ __('Notify me') }}
</button>
</div>
{% if show_checkbox %}
<div class="form-check">
<input type="checkbox"
class="form-check-input"
name="wc_bis_opt_in"
id="wc_bis_opt_in_{{ product_id }}" />
<label class="form-check-label small" for="wc_bis_opt_in_{{ product_id }}">
{{ wc_replace_policy_page_link_placeholders(wc_get_privacy_policy_text('registration'))|wp_kses_post }}
</label>
</div>
{% endif %}
{{ wp_nonce_field('wc_bis_signup', 'wc_bis_nonce') }}
<input type="hidden" name="wc_bis_product_id" value="{{ product_id }}" />
</form>
</div>
</div>