@extends('layouts.admin') @section('title', 'Abandoned checkout #'.$row->id) @section('content') @php $label = fn (?string $v) => ucwords(str_replace('_', ' ', (string) $v)); $statusTone = match ($row->status) { 'open' => 'warning', 'emailed' => 'info', 'recovered' => 'success', default => 'muted', }; $checkout = $row->checkout; $address = $checkout?->shipping_address ?? []; $money = fn (?int $cents) => ($row->currency ?: 'AUD').' '.number_format(((int) $cents) / 100, 2); $abandonedAt = $row->abandoned_at ?? $row->created_at; $sentSteps = $row->emails->where('status', 'sent')->groupBy('step'); $enabledSteps = collect($steps)->filter(fn ($s) => $s['enabled']); $dateTime = fn ($date) => $date?->timezone(config('app.timezone'))->format('j M Y, g:ia'); $funnel = ['contact' => 'Contact details', 'shipping' => 'Shipping address', 'payment' => 'Payment']; $funnelReached = array_search($row->last_step, array_keys($funnel), true); @endphp All abandoned @if($checkout?->token) View checkout @endif @if($row->isRecoverable() && $nextStep)
@csrf
@endif
@if(session('status'))
{{ session('status') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif
Status {{ $label($row->status) }} @if($row->status === 'recovered') {{ $dateTime($row->recovered_at) }} @elseif($row->status === 'suppressed') {{ $row->suppress_reason }} @elseif($row->next_email_at) Next email {{ $row->next_email_at->isPast() ? 'due now' : $row->next_email_at->diffForHumans() }} @else No more emails scheduled @endif
Cart value {{ $row->labeledTotal() }} {{ $row->line_count }} {{ \Illuminate\Support\Str::plural('item', $row->line_count) }}
Emails sent {{ $row->recovery_emails_sent }} {{ $row->last_emailed_at ? 'Last '.$row->last_emailed_at->diffForHumans() : 'None yet' }}
Link clicks {{ $row->click_count }} {{ $row->last_clicked_at ? 'Last '.$row->last_clicked_at->diffForHumans() : 'Not clicked yet' }}
Discount {{ $row->discount_code ?: '—' }} @if($row->discount) {{ $row->discount->usage_count > 0 ? 'Used' : 'Unused' }} · expires {{ $row->discount->ends_at?->format('j M Y') ?? 'never' }} @else No code issued @endif

Cart

Checkout #{{ $row->checkout_id }}
    @forelse($items as $item)
  • @if($item['image']) @else @endif
    @if($item['product_url']) {{ $item['title'] }} @else
    {{ $item['title'] }}
    @endif
    {{ $item['sku'] ? 'SKU '.$item['sku'].' · ' : '' }}{{ $item['quantity'] }} × {{ $money($item['unit_cents']) }}
    {{ $money($item['total_cents']) }}
  • @empty
  • No line items stored on this checkout.
  • @endforelse
Subtotal
{{ $money($checkout?->subtotal_cents ?? $row->subtotal_cents) }}
@if((int) $checkout?->discount_cents > 0)
Discount {{ $checkout->discount_code ? '('.$checkout->discount_code.')' : '' }}
−{{ $money($checkout->discount_cents) }}
@endif @if($checkout?->shipping_rate_id)
Shipping · {{ $checkout->shippingRate?->name }}
{{ $money($checkout->shipping_cents) }}
@endif @if((int) $checkout?->tax_cents > 0)
Tax
{{ $money($checkout->tax_cents) }}
@endif
Total
{{ $row->labeledTotal() }}

Where they stopped

    @foreach($funnel as $key => $funnelLabel) @php $reached = $funnelReached !== false && array_search($key, array_keys($funnel), true) <= $funnelReached; @endphp
  1. {{ $funnelLabel }}
  2. @endforeach
  3. {{ $row->status === 'recovered' ? 'Paid' : 'Not paid' }}

Recovery timeline

  1. Checkout abandoned {{ $dateTime($abandonedAt) }} · stopped at {{ $funnel[$row->last_step] ?? 'unknown step' }}
  2. @foreach($enabledSteps as $number => $step) @php $sent = $sentSteps->get($number)?->first(); @endphp
  3. Email {{ $number }} · {{ $step['subject'] }} @if($sent) Sent {{ $dateTime($sent->created_at) }}{{ $sent->discount_code ? ' with '.$sent->discount_code : '' }}{{ $sent->clicked_at ? ' · clicked '.$sent->clicked_at->diffForHumans() : '' }} @elseif($row->isActive() && $nextStep === $number && $row->next_email_at) Scheduled for {{ $dateTime($row->next_email_at) }} @elseif($row->isActive()) Planned {{ $service->delayLabel($step) }} after abandonment @else Not sent @endif
  4. @endforeach
  5. Recovered @if($row->recovered_at) {{ $dateTime($row->recovered_at) }} @if($row->recoveredOrder) · Order {{ $row->recoveredOrder->number }} @endif @else Not yet @endif

Email history

@if($row->emails->isEmpty())

No recovery emails have been sent yet.

@else
@foreach($row->emails as $email) @endforeach
SentEmailDiscountResultBy
{{ $dateTime($email->created_at) }}
#{{ $email->step }} · {{ $email->subject }}
to {{ $email->to_email }}
{{ $email->discount_code ? $email->discount_code.' ('.$email->discount_summary.')' : '—' }} {{ $label($email->status) }} @if($email->clicked_at)
Clicked {{ $email->clicked_at->diffForHumans() }}
@endif @if($email->error)
{{ $email->error }}
@endif
{{ $email->trigger === 'auto' ? 'Automatic' : ($email->sender?->name ?? 'Admin') }}
@endif

Customer

Name
{{ $row->customer_name ?: ($address['name'] ?? '—') }}
Email
@if($row->email){{ $row->email }}@else — @endif
Phone
@if($row->phone ?: ($address['phone'] ?? null)){{ $row->phone ?: $address['phone'] }}@else — @endif
Shipping address
@if($address) {{ collect([$address['line1'] ?? null, $address['line2'] ?? null])->filter()->implode(', ') }}
{{ collect([$address['city'] ?? null, $address['region'] ?? null, $address['postal_code'] ?? null])->filter()->implode(' ') }}
{{ $address['country'] ?? $row->country }} @else Not entered · {{ $row->country ?: 'unknown country' }} @endif
Account
@if($row->customer) Customer #{{ $row->customer_id }} @else Guest checkout @endif
@if($checkout?->notes)
Checkout note
{{ $checkout->notes }}
@endif
Source
{{ collect([$row->utm_source ?: $row->source, $row->utm_medium, $row->utm_campaign])->filter()->implode(' / ') ?: 'web' }}
@if($previousOrders->isNotEmpty() || $otherAbandoned->isNotEmpty())

History with this email

@if($previousOrders->isNotEmpty())
Orders
    @foreach($previousOrders as $order)
  • {{ $order->number }} {{ $order->created_at->format('j M Y') }} · {{ $label($order->payment_status) }} · {{ $order->currency }} {{ number_format($order->total_cents / 100, 2) }}
  • @endforeach
@endif @if($otherAbandoned->isNotEmpty())
Other abandoned checkouts
    @foreach($otherAbandoned as $other)
  • #{{ $other->id }} {{ ($other->abandoned_at ?? $other->created_at)?->format('j M Y') }} · {{ $label($other->status) }} · {{ $other->labeledTotal() }}
  • @endforeach
@endif
@endif @if($row->isActive())

Send an email

Send any template now, with its own discount, no discount, or a custom one for this customer.

@csrf
@endif

Manage

@if($row->isActive())
@csrf
@csrf
@else

This checkout is {{ $label($row->status) }} and is no longer in the recovery sequence.

@endif
@csrf @method('PUT')
@endsection