Files
wc-bootstrap/templates/cart/cart-shipping.html.twig

70 lines
3.0 KiB
Twig
Raw Normal View History

Implement Phase 4 & 5: cart and checkout templates (Bootstrap 5, HPOS) Phase 4 - Cart (9 templates): - cart: 8+4 column layout, table-responsive items, coupon input-group - cart-empty: centered empty state with cart-x icon - cart-item-data: inline dl for variation details - cart-totals: card with list-group-flush rows, sticky sidebar - cart-shipping: form-check radio per shipping method - cross-sells: product loop grid section - mini-cart: offcanvas-compatible item list with remove buttons - proceed-to-checkout-button: btn-primary btn-lg w-100 - shipping-calculator: collapsible form with form-select/form-control Phase 5 - Checkout (12 templates): - form-checkout: 7+5 column layout, sticky order review sidebar - form-billing: card with field wrapper, optional account creation - form-shipping: card with ship-to-different-address collapse toggle - form-coupon: collapsible input-group with alert-info toggle - form-login: collapsible login reusing global/form-login.html.twig - review-order: card with table-sm, tfoot subtotal/shipping/total - payment: list-group of payment gateways with radio selection - payment-method: form-check with description collapse - terms: form-check checkbox with T&C link - thankyou: HPOS compatible, alert-success + order details list-group - order-received: confirmation message - cart-errors: alert-danger with return-to-cart button All order data accessed via WC_Order methods (HPOS compatible). CSS additions: cart thumbnail sizing, checkout form field overrides, payment box transitions, dark mode focus states. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:33:49 +01:00
{#
# Cart Shipping Methods (Bootstrap 5 Override)
#
# Renders available shipping methods as Bootstrap form-check radios.
#
# Expected context:
# available_methods - Array of shipping method objects
# chosen_method - Currently chosen method ID
# formatted_destination - Formatted shipping address
# has_calculated_shipping - Whether shipping has been calculated
# show_shipping_calculator - Whether to show the calculator
# package_name - Package name/label
# index - Package index
#
# WooCommerce PHP equivalent: cart/cart-shipping.php
#
# @package WcBootstrap
# @since 0.1.0
#}
<div class="woocommerce-shipping-totals shipping">
<strong class="d-block mb-2">{{ package_name|default(__('Shipping'))|esc_html }}</strong>
{% if available_methods is defined and available_methods|length > 0 %}
<ul id="shipping_method_{{ index|default(0) }}" class="list-unstyled mb-2">
{% for method_id, method in available_methods %}
<li class="form-check">
{% if available_methods|length > 1 %}
<input type="radio"
name="shipping_method[{{ index|default(0) }}]"
id="shipping_method_{{ index|default(0) }}_{{ method_id|esc_attr }}"
value="{{ method_id|esc_attr }}"
class="form-check-input shipping_method"
data-index="{{ index|default(0) }}"
{% if method_id == chosen_method %}checked{% endif %} />
{% else %}
<input type="hidden"
name="shipping_method[{{ index|default(0) }}]"
value="{{ method_id|esc_attr }}"
class="shipping_method"
data-index="{{ index|default(0) }}" />
{% endif %}
<label class="form-check-label" for="shipping_method_{{ index|default(0) }}_{{ method_id|esc_attr }}">
{{ method.get_label()|raw }}
</label>
{{ do_action('woocommerce_after_shipping_rate', method, index|default(0)) }}
</li>
{% endfor %}
</ul>
{% if formatted_destination is defined and formatted_destination %}
<p class="woocommerce-shipping-destination small text-body-secondary mb-0">
{{ formatted_destination|raw }}
</p>
{% endif %}
{% elseif not has_calculated_shipping|default(false) %}
<p class="text-body-secondary small mb-0">
{{ __('Shipping costs are calculated during checkout.') }}
</p>
{% else %}
<p class="text-body-secondary small mb-0">
{{ __('No shipping options were found.') }}
</p>
{% endif %}
{% if show_shipping_calculator|default(false) %}
{% include 'cart/shipping-calculator.html.twig' %}
{% endif %}
</div>