@include('layouts.header')
{{-- Flash + validation messages (single block) --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif {{-- Coupon row --}}
@csrf
{{-- LEFT: Billing details --}}
Billing detail
@php $oldSelected = old('selected_address_id', request('selected_address_id')); @endphp {{-- Saved addresses (for logged-in users) --}} @php $hasDbAddresses = isset($addresses) && $addresses->count(); $hasGuestAddress = !empty($guestAddress); @endphp @if($hasDbAddresses || $hasGuestAddress)
Your saved addresses
{{-- 1) Logged-in user's saved addresses from DB --}} @if($hasDbAddresses) @foreach($addresses as $addr) @php $isFirst = $loop->first && !$hasGuestAddress; // if guest exists, let guest be default $isChecked = $oldSelected ? ($oldSelected == $addr->address_id) : $isFirst; @endphp @endforeach @endif {{-- 2) Guest address stored in session --}} @if($hasGuestAddress) @php $guestFullName = trim(($guestAddress['first_name'] ?? '') . ' ' . ($guestAddress['last_name'] ?? '')); $isChecked = $oldSelected ? ($oldSelected === 'guest') : true; // default checked for guest if nothing else selected @endphp @endif {{-- 3) Always show "Use a new billing address" option --}}
@endif {{-- Billing form (shown when "new" or no saved addresses) --}}
{{-- First Name --}}

First Name *

{{-- Last Name --}}

Last Name *

{{-- Country --}}

Country *

@error('country') {{ $message }} @enderror
{{-- Address --}}

Address *

{{-- City --}}

Town/City *

{{-- State --}}

State *

{{-- Postcode --}}

Postcode/Zip *

{{-- Country Code --}}

Country Code *

{{-- Phone --}}

Phone *

{{-- Email --}}

Email

{{-- Create account --}}

Create an account using this email. If you already have an account, this address will be saved to your profile.

{{-- Account Password (show only when checkbox checked via JS) --}} {{-- Order notes --}}

Order notes

{{-- Save address (for shipping + profile) --}}
{{-- RIGHT: Order summary --}}
Your order
  • Product Total
  • @php $subtotalBase = 0; $currencySymbol = session('currency_symbol', '$'); $currencyRate = session('currency_rate', 1); $subtotalDisplay = 0; @endphp @foreach($cart as $item) @php $lineTotalBase = $item['price'] * $item['qty']; $lineTotalDisplay = $lineTotalBase * $currencyRate; $subtotalBase += $lineTotalBase; $subtotalDisplay += $lineTotalDisplay; @endphp
  • {{ $loop->iteration }}. {{ $item['name'] }} x {{ $item['qty'] }} {{ $currencySymbol }} {{ number_format($lineTotalDisplay, 2) }}
  • @endforeach
    @php $currencySymbol = session('currency_symbol', '$'); $currencyRate = session('currency_rate', 1); $shippingTotalDisplay = ($total_shipping_charge ?? 0) * $currencyRate; @endphp {{-- Subtotal --}}
  • Subtotal {{ $currencySymbol }} {{ number_format($subtotalDisplay, 2) }}
  • {{-- Shipping charges --}}
  • Shipping charges {{ $currencySymbol }} {{ number_format($shippingTotalDisplay, 2) }}
  • {{-- Discount --}} {{-- Final total = subtotal - discount + shipping --}}
  • Total {{ $currencySymbol }} {{ number_format($subtotalDisplay + ($shippingAvailable ? $shippingTotalDisplay : 0), 2) }}
@include('layouts.footer')
+