{{-- Server-rendered cart contents. Rendered inline on first page load inside checkout/drawer.blade.php, and re-fetched + swapped into the drawer by bbk-cart-controller after every mutation. $cart / $lines come from the view composer in CheckoutModuleServiceProvider. The data-bbk-cart-* attributes on the root are the module's read API for the host (e.g. the header bag-icon count) — bbk-cart-controller reads them after each swap and re-emits them on the `bbk-cart:updated` window event. --}} @php($count = $lines->sum('quantity')) {{-- @dump($lines) --}}
@if ($lines->isEmpty())

{{ __('checkout.cart.empty') }}

@else
@if ($cart?->coupon_code)
{{ $cart->coupon_code }}
@csrf @method('DELETE')
@else
@csrf
@if ($couponError ?? false) @endif @endif
{{ __('checkout.cart.subtotal') }} {{ $cart?->subTotal?->formatted() }}
@if ($cart?->discountTotal?->value > 0)
{{ __('checkout.cart.discount') }} −{{ $cart->discountTotal->formatted() }}
@endif {{-- Shipping + tax appear once the shopper has a shipping address (i.e. they're on the checkout page). In the drawer, where no address is set yet, only subtotal + total show. --}} @if ($cart?->shippingAddress)
{{ __('checkout.cart.shipping') }} @if ($cart->shippingAddress->shipping_option) {{ $cart->shippingTotal?->formatted() }} @else {{ __('checkout.cart.shipping_pending') }} @endif
@endif @if ($cart?->taxTotal?->value > 0)
{{ __('checkout.cart.tax') }} {{ $cart->taxTotal->formatted() }}
@endif {{-- Always shown — equals subtotal with nothing else applied, diverges as discount / shipping / tax come in. --}}
{{ __('checkout.cart.total') }} {{ $cart?->total?->formatted() }}
{{ __('checkout.cart.checkout') }}
@endif