You've already forked wc-bootstrap
Implement Phase 3: single product page templates (Bootstrap 5)
Add 21 Twig template overrides for the single product page: Product layout: - product-image: gallery with thumbnail strip, img-fluid rounded - title: h1 entry-title - price: fs-3 fw-bold with sale del/ins markup - short-description: lead text-body-secondary - meta: dl row with SKU, categories, tags - rating: Bootstrap Icon stars with half-star, review count link - stock: badge (bg-success/bg-danger/bg-warning) per status - sale-flash: badge bg-danger fs-6 - share: hook-only wrapper - product-attributes: table-sm table-striped Related/upsells: - related, up-sells: section with product loop grid Tabs: - tabs: nav-tabs + tab-content with fade transitions - description: tab-pane with prose content - additional-information: tab-pane with attributes hook Add to cart (4 product types + variation JS): - simple: input-group quantity + btn-primary btn-lg - variable: form-select per attribute + variation display - grouped: table-borderless with quantity per child product - external: btn-outline-primary with external link icon - variation: Underscore.js script templates (Bootstrap-styled) - variation-add-to-cart-button: quantity + submit with hidden fields CSS additions: gallery thumbnail hover, variation selector spacing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
84
templates/single-product/add-to-cart/grouped.html.twig
Normal file
84
templates/single-product/add-to-cart/grouped.html.twig
Normal file
@@ -0,0 +1,84 @@
|
||||
{#
|
||||
# Grouped Product Add to Cart (Bootstrap 5 Override)
|
||||
#
|
||||
# Add-to-cart form for grouped products: table of child products with quantities.
|
||||
#
|
||||
# Expected context:
|
||||
# product - WC_Product_Grouped object
|
||||
# grouped_products - Array of child WC_Product objects
|
||||
# grouped_product_columns - Array of column definitions
|
||||
# quantites_required - Whether quantities are required
|
||||
# show_add_to_cart_button - Whether to show the submit button
|
||||
#
|
||||
# WooCommerce PHP equivalent: single-product/add-to-cart/grouped.php
|
||||
#
|
||||
# @package WcBootstrap
|
||||
# @since 0.1.0
|
||||
#}
|
||||
|
||||
{{ do_action('woocommerce_before_add_to_cart_form') }}
|
||||
|
||||
<form class="cart grouped_form" action="{{ product.get_permalink()|esc_url }}" method="post" enctype="multipart/form-data">
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="woocommerce-grouped-product-list group_table table table-borderless align-middle">
|
||||
{{ do_action('woocommerce_grouped_product_list_before') }}
|
||||
|
||||
{% for grouped_product in grouped_products %}
|
||||
{% set child_id = grouped_product.get_id() %}
|
||||
<tr id="product-{{ child_id }}" class="{{ grouped_product.get_stock_status() }}">
|
||||
<td class="woocommerce-grouped-product-list-item__quantity" style="width: 140px;">
|
||||
{% if grouped_product.is_purchasable() and grouped_product.is_in_stock() %}
|
||||
{% include 'global/quantity-input.html.twig' with {
|
||||
input_id: 'quantity_' ~ child_id,
|
||||
input_name: 'quantity[' ~ child_id ~ ']',
|
||||
input_value: 0,
|
||||
min_value: 0,
|
||||
max_value: grouped_product.get_max_purchase_quantity()|default(0),
|
||||
step: 1,
|
||||
placeholder: '0',
|
||||
inputmode: 'numeric',
|
||||
classes: 'qty',
|
||||
readonly: false,
|
||||
type: 'number',
|
||||
args: { product_name: grouped_product.get_name() }
|
||||
} %}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="woocommerce-grouped-product-list-item__label">
|
||||
<label for="quantity_{{ child_id }}">
|
||||
{% if grouped_product.is_visible() %}
|
||||
<a href="{{ grouped_product.get_permalink()|esc_url }}" class="text-decoration-none">
|
||||
{{ grouped_product.get_name()|esc_html }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ grouped_product.get_name()|esc_html }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</td>
|
||||
|
||||
<td class="woocommerce-grouped-product-list-item__price text-end">
|
||||
<span class="price">
|
||||
{{ grouped_product.get_price_html()|raw }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{{ do_action('woocommerce_grouped_product_list_after') }}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% if show_add_to_cart_button is not defined or show_add_to_cart_button %}
|
||||
{{ do_action('woocommerce_before_add_to_cart_button') }}
|
||||
|
||||
<input type="hidden" name="add-to-cart" value="{{ product.get_id() }}" />
|
||||
<button type="submit" class="btn btn-primary btn-lg single_add_to_cart_button">
|
||||
{{ product.single_add_to_cart_text() }}
|
||||
</button>
|
||||
|
||||
{{ do_action('woocommerce_after_add_to_cart_button') }}
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{{ do_action('woocommerce_after_add_to_cart_form') }}
|
||||
Reference in New Issue
Block a user