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

83 lines
2.8 KiB
Twig
Raw Permalink 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 Totals (Bootstrap 5 Override)
#
# Renders the cart totals as a Bootstrap card with list-group rows.
#
# Expected context:
# cart - WC()->cart object (subtotal, fees, coupons, shipping, total)
# cart_subtotal - Pre-rendered subtotal HTML
# cart_total - Pre-rendered total HTML
# coupons - Array of applied coupon objects
# fees - Array of fee objects
#
# WooCommerce PHP equivalent: cart/cart-totals.php
#
# @package WcBootstrap
# @since 0.1.0
#}
<div class="cart_totals">
{{ do_action('woocommerce_before_cart_totals') }}
<div class="card shadow-sm">
<div class="card-header">
<h2 class="h5 mb-0">{{ __('Cart totals') }}</h2>
</div>
<ul class="list-group list-group-flush">
{# Subtotal #}
<li class="list-group-item d-flex justify-content-between">
<span>{{ __('Subtotal') }}</span>
<span>{{ cart_subtotal|default(cart.get_cart_subtotal())|raw }}</span>
</li>
{# Coupons #}
{% if coupons is defined %}
{% for coupon in coupons %}
<li class="list-group-item d-flex justify-content-between">
<span>{{ __('Coupon:') }} {{ coupon.code|esc_html }}</span>
<span>{{ coupon.discount_html|raw }}</span>
</li>
{% endfor %}
{% endif %}
{# Shipping #}
{{ do_action('woocommerce_cart_totals_before_shipping') }}
{% if wc_shipping_enabled() %}
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
<li class="list-group-item cart-shipping">
{{ do_action('woocommerce_cart_totals_shipping') }}
</li>
{% endif %}
{{ do_action('woocommerce_cart_totals_after_shipping') }}
{# Fees #}
{% if fees is defined %}
{% for fee in fees %}
<li class="list-group-item d-flex justify-content-between">
<span>{{ fee.name|esc_html }}</span>
<span>{{ fee.total_html|raw }}</span>
</li>
{% endfor %}
{% endif %}
{{ do_action('woocommerce_cart_totals_before_order_total') }}
{# Order total #}
<li class="list-group-item d-flex justify-content-between fw-bold fs-5">
<span>{{ __('Total') }}</span>
<span>{{ cart_total|default(cart.get_total())|raw }}</span>
</li>
{{ do_action('woocommerce_cart_totals_after_order_total') }}
</ul>
<div class="card-body">
{{ do_action('woocommerce_proceed_to_checkout') }}
</div>
</div>
{{ do_action('woocommerce_after_cart_totals') }}
</div>