You've already forked wc-bootstrap
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>
This commit is contained in:
109
templates/cart/shipping-calculator.html.twig
Normal file
109
templates/cart/shipping-calculator.html.twig
Normal file
@@ -0,0 +1,109 @@
|
||||
{#
|
||||
# Shipping Calculator (Bootstrap 5 Override)
|
||||
#
|
||||
# Collapsible form to estimate shipping costs.
|
||||
#
|
||||
# Expected context:
|
||||
# button_text - Submit button text
|
||||
# customer_country - Selected country code
|
||||
# customer_state - Selected state code
|
||||
# customer_city - City value
|
||||
# customer_postcode - Postcode value
|
||||
# countries - Array of country options
|
||||
# states - Array of state options for selected country
|
||||
# show_country - Whether to show country field
|
||||
# show_state - Whether to show state field
|
||||
# show_city - Whether to show city field
|
||||
# show_postcode - Whether to show postcode field
|
||||
#
|
||||
# WooCommerce PHP equivalent: cart/shipping-calculator.php
|
||||
#
|
||||
# @package WcBootstrap
|
||||
# @since 0.1.0
|
||||
#}
|
||||
|
||||
{{ do_action('woocommerce_before_shipping_calculator') }}
|
||||
|
||||
<form class="woocommerce-shipping-calculator mt-3" action="{{ wc_get_cart_url()|esc_url }}" method="post">
|
||||
<a href="#shippingCalcForm"
|
||||
class="btn btn-sm btn-outline-secondary"
|
||||
data-bs-toggle="collapse"
|
||||
role="button"
|
||||
aria-expanded="false"
|
||||
aria-controls="shippingCalcForm">
|
||||
{{ __('Calculate shipping') }}
|
||||
</a>
|
||||
|
||||
<div class="collapse mt-3" id="shippingCalcForm">
|
||||
{% if show_country|default(true) %}
|
||||
<div class="mb-3">
|
||||
<label for="calc_shipping_country" class="form-label">{{ __('Country / region') }}</label>
|
||||
<select name="calc_shipping_country" id="calc_shipping_country" class="form-select country_to_state">
|
||||
<option value="default">{{ __('Select a country / region…') }}</option>
|
||||
{% if countries is defined %}
|
||||
{% for code, name in countries %}
|
||||
<option value="{{ code|esc_attr }}"{% if code == customer_country %} selected{% endif %}>
|
||||
{{ name|esc_html }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_state|default(true) %}
|
||||
<div class="mb-3">
|
||||
<label for="calc_shipping_state" class="form-label">{{ __('State / county') }}</label>
|
||||
{% if states is defined and states|length > 0 %}
|
||||
<select name="calc_shipping_state" id="calc_shipping_state" class="form-select">
|
||||
<option value="">{{ __('Select an option…') }}</option>
|
||||
{% for code, name in states %}
|
||||
<option value="{{ code|esc_attr }}"{% if code == customer_state %} selected{% endif %}>
|
||||
{{ name|esc_html }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="calc_shipping_state"
|
||||
id="calc_shipping_state"
|
||||
placeholder="{{ __('State / county') }}"
|
||||
value="{{ customer_state|default('')|esc_attr }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_city|default(false) %}
|
||||
<div class="mb-3">
|
||||
<label for="calc_shipping_city" class="form-label">{{ __('City') }}</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="calc_shipping_city"
|
||||
id="calc_shipping_city"
|
||||
placeholder="{{ __('City') }}"
|
||||
value="{{ customer_city|default('')|esc_attr }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_postcode|default(true) %}
|
||||
<div class="mb-3">
|
||||
<label for="calc_shipping_postcode" class="form-label">{{ __('Postcode / ZIP') }}</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="calc_shipping_postcode"
|
||||
id="calc_shipping_postcode"
|
||||
placeholder="{{ __('Postcode / ZIP') }}"
|
||||
value="{{ customer_postcode|default('')|esc_attr }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<button type="submit" name="calc_shipping" value="1" class="btn btn-outline-primary">
|
||||
{{ button_text|default(__('Update')) }}
|
||||
</button>
|
||||
|
||||
{{ wp_nonce_field('woocommerce-shipping-calculator', 'woocommerce-shipping-calculator-nonce') }}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ do_action('woocommerce_after_shipping_calculator') }}
|
||||
Reference in New Issue
Block a user