Files
wc-bootstrap/templates/cart/cart-totals.html.twig
magdev 6ee95f4a2f
All checks were successful
Create Release Package / PHP Lint (push) Successful in 57s
Create Release Package / Build Release (push) Successful in 1m11s
Fix template quirks and bump version to 0.1.0
Audit and fix 14 Twig templates for escaping bugs, CSS conflicts,
and missing Bootstrap styling:
- Fix nl2br/esc_html filter order in order details
- Add WC gallery modifier classes for zoom/photoswipe JS init
- Fix HTML entity double-encoding in headings (up-sells, cross-sells, related)
- Remove wrong 'is defined' guards on function calls
- Remove duplicate deprecated hooks in dashboard
- Add |raw to brand description HTML filter chain
- Add role="alert" for accessibility, |esc_attr on notification types
- Style mini-cart remove button as Bootstrap btn
- Make shipping form-check class conditional
- Add shop_table CSS reset and gallery opacity fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:50:19 +01:00

83 lines
2.8 KiB
Twig

{#
# 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() %}
<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>