Implement Phase 9 & reusable components; skip Phase 8 (emails)

Phase 8 (Emails) skipped: WooCommerce email rendering uses
wc_get_template_html() which bypasses the Twig pipeline entirely.
Email customization deferred to plugins or block email editor.

Phase 9 - Supplementary (7 templates):
- Brand description with thumbnail, taxonomy archive delegate
- Brands A-Z shortcode with alphabetical index navigation
- Single brand thumbnail shortcode
- REST API OAuth login and grant-access forms
- Back-in-stock notification form with email input

Reusable Components (6 templates):
- price: product price display with sale handling
- rating: star rating with Bootstrap Icons (filled/half/empty)
- address-card: billing/shipping address card with edit link
- status-badge: contextual order status badges
- quantity-input: +/- input group widget
- form-field: universal form field renderer (text/select/textarea/checkbox)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 10:53:44 +01:00
parent 8b1793097c
commit 49b1d52701
14 changed files with 657 additions and 35 deletions

View File

@@ -0,0 +1,52 @@
{#
# Quantity Input Component (Bootstrap 5)
#
# Reusable quantity input with +/- buttons using Bootstrap input-group.
# Works with the quantity.js script for increment/decrement.
#
# Expected context:
# input_name - Input name attribute (default: 'quantity')
# input_id - Input id attribute (optional)
# input_value - Current quantity value (default: 1)
# min_value - Minimum quantity (default: 1)
# max_value - Maximum quantity (default: '')
# step - Step increment (default: 1)
# classes - Additional CSS classes (optional)
#
# Usage:
# {% include 'components/quantity-input.html.twig' with {
# input_name: 'quantity',
# input_value: 1,
# min_value: 1,
# max_value: product.get_max_purchase_quantity()
# } %}
#
# @package WcBootstrap
# @since 0.1.0
#}
{% set qty_name = input_name|default('quantity') %}
{% set qty_id = input_id|default('quantity_' ~ random()) %}
{% set qty_value = input_value|default(1) %}
{% set qty_min = min_value|default(1) %}
{% set qty_max = max_value|default('') %}
{% set qty_step = step|default(1) %}
<div class="quantity input-group input-group-sm {{ classes|default('') }}" style="max-width: 140px;">
<button type="button" class="btn btn-outline-secondary qty-minus" aria-label="{{ __('Decrease quantity') }}">
<i class="bi bi-dash" aria-hidden="true"></i>
</button>
<input type="number"
class="form-control text-center"
name="{{ qty_name|esc_attr }}"
id="{{ qty_id|esc_attr }}"
value="{{ qty_value|esc_attr }}"
min="{{ qty_min|esc_attr }}"
{% if qty_max %}max="{{ qty_max|esc_attr }}"{% endif %}
step="{{ qty_step|esc_attr }}"
inputmode="numeric"
aria-label="{{ __('Quantity') }}" />
<button type="button" class="btn btn-outline-secondary qty-plus" aria-label="{{ __('Increase quantity') }}">
<i class="bi bi-plus" aria-hidden="true"></i>
</button>
</div>