Files
wc-bootstrap/templates/single-product/add-to-cart/variation-add-to-cart-button.html.twig
magdev 784b400c46
All checks were successful
Create Release Package / PHP Lint (push) Successful in 44s
Create Release Package / Build Release (push) Successful in 52s
Fix 10 known bugs: catalog, single product, and account pages (v0.1.5)
Catalog: page title via woocommerce_page_title(), breadcrumbs, category
template rename (underscore), 3-column grid, single chevron on sort.

Single product: variable form data attributes + disabled CSS class fix
(WC JS only toggles CSS classes, not HTML disabled attribute), dark mode
select specificity (0,5,1) to beat WC's (0,4,3) background shorthand,
gallery main image in thumbnail strip with empty URL guard, related/
upsells setup_postdata for correct global $product, grouped product
loop logic rewrite.

Account: downloads via wc_get_customer_available_downloads().

New: product-gallery.js, sanitize_title filter, wc_setup_product_data()
and wp_reset_postdata() Twig functions, product-thumbnails.html.twig
suppressor. Removed obsolete PLAN.md and SETUP.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 03:33:31 +01:00

51 lines
1.7 KiB
Twig

{#
# Variation Add to Cart Button (Bootstrap 5 Override)
#
# Renders the quantity input and add-to-cart button for variable products
# after variation selection.
#
# Expected context:
# product - WC_Product_Variable object
#
# WooCommerce PHP equivalent: single-product/add-to-cart/variation-add-to-cart-button.php
#
# @package WcBootstrap
# @since 0.1.0
#}
<div class="woocommerce-variation-add-to-cart variations_button">
{{ do_action('woocommerce_before_add_to_cart_button') }}
<div class="d-flex align-items-end gap-3 mb-3">
{{ do_action('woocommerce_before_add_to_cart_quantity') }}
{% include 'global/quantity-input.html.twig' with {
input_id: 'quantity_' ~ product.get_id(),
input_name: 'quantity',
input_value: 1,
min_value: product.get_min_purchase_quantity()|default(1),
max_value: product.get_max_purchase_quantity()|default(0),
step: 1,
placeholder: '',
inputmode: 'numeric',
classes: 'qty',
readonly: false,
type: 'number',
args: { product_name: product.get_name() }
} %}
{{ do_action('woocommerce_after_add_to_cart_quantity') }}
<button type="submit"
class="btn btn-primary btn-lg single_add_to_cart_button disabled wc-variation-selection-needed">
{{ product.single_add_to_cart_text() }}
</button>
</div>
<input type="hidden" name="add-to-cart" value="{{ product.get_id() }}" />
<input type="hidden" name="product_id" value="{{ product.get_id() }}" />
<input type="hidden" name="variation_id" class="variation_id" value="0" />
{{ do_action('woocommerce_after_add_to_cart_button') }}
</div>