@endif
@php
$oldSessionAddressId = old('address.address_id', $sessionAddressId);
@endphp
@if ($isAvailableAddress && $oldSessionAddressId != 'new')
@if ($oldSessionAddressId && $addresses->contains('id', $oldSessionAddressId))
@include('plugins/ecommerce::orders.partials.address-item', [
'address' => $addresses->firstWhere('id', $oldSessionAddressId),
])
@elseif ($defaultAddress = get_default_customer_address())
@include('plugins/ecommerce::orders.partials.address-item', [
'address' => $defaultAddress,
])
@else
@include('plugins/ecommerce::orders.partials.address-item', [
'address' => Arr::first($addresses),
])
@endif
@endif
@if ($isAvailableAddress)
@foreach ($addresses as $address)
@include(
'plugins/ecommerce::orders.partials.address-item',
compact('address'))
@endforeach
@endif