@extends('layouts.app') @section('title', 'Marketing') @section('content') @php $marketingTz = config('app.deals_display_timezone', 'America/New_York'); $todayDate = now($marketingTz)->format('Y-m-d'); $discountDefaults = ($marketingSettings ?? \App\Models\MarketingSetting::get())->discountModalDefaults(); $defaultExpiryDays = (int) ($discountDefaults['coupon_default_expiry_days'] ?? 15); @endphp

Marketing

Abandoned checkouts — contacts and products left at checkout. Use this list to follow up with customers (e.g. email or discount).

Automatic coupons (active in Shopify) {{ $marketingStats['automatic_coupons'] ?? 0 }}
Manual coupons (active in Shopify) {{ $marketingStats['manual_coupons'] ?? 0 }}
Total Marketing (active in Shopify) {{ $marketingStats['total_coupons'] ?? 0 }}
@if($marketingStats['coupon_stats_from_shopify'] ?? true)

Counts match Shopify: only active discounts titled "Abandoned checkout" (created from this Marketing menu). Offers and other discounts are not included.

@else

Could not load counts from Shopify; showing active coupons from the local database instead.

@endif
Recovered orders {{ $marketingStats['total_recovered'] ?? 0 }}
Recovered with coupon {{ $marketingStats['recovered_with_coupon'] ?? 0 }}
Total coupons (all time) {{ $marketingStats['total_coupons_all_time'] ?? $marketingStats['total_coupons'] ?? 0 }}
Expired coupons {{ $marketingStats['expired_coupons'] ?? 0 }}
Deleted coupons {{ $marketingStats['deleted_coupons'] ?? 0 }}
Deactivated coupons {{ $marketingStats['deactivated_coupons'] ?? 0 }}
Notifications sent today {{ $marketingStats['notifications_sent_today'] ?? 0 }}

Recovered orders: all abandoned checkouts that were later completed (paid). Recovered with coupon: those that used a discount code created from the cards below. Expired: coupons created from these cards and deactivated after expiration (only Marketing coupons are counted; Shopify may show more if you have other discounts). Deleted: cumulative count of coupons deleted from Shopify (via the Settings button or the scheduled cleanup). Deactivated: coupons temporarily paused while the product is in Deal of the Day; they reactivate automatically when the deal ends. Notifications sent today: count of discount emails and SMS sent today; resets to 0 at midnight.

Refresh stats now to see the latest numbers immediately. Configure Marketing settings (coupon cleanup, test email/SMS) in Setting →

@php $qp = $queryParams ?? ['range' => 'today', 'status' => 'open', 'email' => 'all', 'contact' => 'any', 'discount' => 'all', 'discounts_used' => 'all', 'from' => '', 'to' => '']; $baseParams = function($overrides = []) use ($qp) { $merged = array_merge([ 'range' => $qp['range'] ?? 'today', 'status' => $qp['status'] ?? 'open', 'email' => $qp['email'] ?? 'all', 'contact' => $qp['contact'] ?? 'any', 'discount' => $qp['discount'] ?? 'all', 'discounts_used' => $qp['discounts_used'] ?? 'all', 'from' => $qp['from'] ?? null, 'to' => $qp['to'] ?? null, ], $overrides); return array_filter($merged, function ($v) { return $v !== null && $v !== ''; }); }; $dateLink = function($range) use ($baseParams) { return route('marketing.index', $baseParams(['range' => $range])); }; $statusLink = function($status) use ($baseParams) { return route('marketing.index', $baseParams(['status' => $status])); }; $emailLink = function($email) use ($baseParams) { return route('marketing.index', $baseParams(['email' => $email])); }; $contactLink = function($contact) use ($baseParams) { return route('marketing.index', $baseParams(['contact' => $contact])); }; $discountsUsedLink = function($value) use ($baseParams) { return route('marketing.index', $baseParams(['discounts_used' => $value])); }; @endphp
Date
Status
Notification
Contact
Discount
@include('marketing.partials.cards', [ 'abandonedCheckouts' => $abandonedCheckouts, 'marketingFeeDefaults' => $discountDefaults, ])
{{-- Modal: Create discount for this customer --}} {{-- Modal: Choose notification channel (Email / SMS / Both) when customer has both --}} {{-- Modal: Notification already sent today — recommend waiting 1 day --}} {{-- Modal: Edit fees (opens from icon next to Profit after fees) --}} @push('scripts') @endpush @push('styles') @endpush @if(!$abandonedCheckouts->isEmpty()) @push('scripts') @endpush @endif @push('scripts') @endpush @endsection