You've already forked wc-bootstrap
83 lines
2.8 KiB
Twig
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() is defined and 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>
|