Files
wc-bootstrap/templates/cart/cart-shipping.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

70 lines
3.1 KiB
Twig

{#
# 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{% if available_methods|length > 1 %} class="form-check"{% endif %}>
{% 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="{{ available_methods|length > 1 ? '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>