@extends('storefront.layout') @section('title', 'Checkout') @section('content') @php $enabledMethods = (array) ($checkoutConfig['payment_methods'] ?? ['stripe', 'cash_on_delivery']); $methodLabels = [ 'stripe' => 'Credit Card', 'cash_on_delivery' => 'Cash on Delivery', 'bank_transfer' => 'Bank Transfer', 'easypaisa' => 'EasyPaisa', 'jazzcash' => 'JazzCash', ]; $methodIcons = (array) ($checkoutConfig['payment_icons'] ?? []); $paymentAccounts = (array) ($checkoutConfig['payment_accounts'] ?? []); $paymentCfg = (array) ($checkoutConfig['payment'] ?? []); $shippingCfg = (array) ($checkoutConfig['shipping'] ?? []); $shippingOptions = (array) ($checkoutConfig['shipping_options'] ?? []); $shippingLookup = (array) ($checkoutConfig['shipping_lookup'] ?? [ 'countries' => [], 'cities_by_country' => [], 'global_cities' => [], 'areas_by_country' => [], 'global_areas' => [], 'area_hints' => [], 'zip_hints' => [], ]); $proofRequiredMethods = (array) ($paymentCfg['proof_required_methods'] ?? []); $transactionIdRequiredMethods = (array) ($paymentCfg['transaction_id_required_methods'] ?? []); $selectedMethod = old('payment_method', in_array('stripe', $enabledMethods, true) ? 'stripe' : ($enabledMethods[0] ?? 'cash_on_delivery')); $selectedShipping = old('shipping_option', $summary['selected_shipping_option'] ?? (!empty($shippingCfg['allow_pickup']) ? 'pickup' : (($shippingOptions[0]['key'] ?? '')))); $couponConfigJs = $checkoutConfig['coupon'] ?? ['is_active' => false, 'code' => '', 'type' => 'fixed', 'value' => 0]; @endphp

Checkout

@if($errors->any())
@foreach($errors->all() as $err)

{{ $err }}

@endforeach
@endif
@csrf @if(!empty($newCustomerDiscount)) @php $ncd = $newCustomerDiscount; $ncdValue = $ncd->discount_type === 'percentage' ? $ncd->value . '% off' : format_currency($ncd->value) . ' off'; @endphp
New customer? Create an account and get {{ $ncdValue }} on your first order! @if($ncd->is_coupon && $ncd->coupon_code) Use code {{ $ncd->coupon_code }} at checkout. @endif
@endif

Customer details

@if(!empty($shippingCfg['allow_delivery']) || !empty($shippingCfg['allow_pickup']))

Shipping

{{-- Method selector cards --}}
@if(!empty($shippingCfg['allow_pickup'])) @endif @foreach($shippingOptions as $opt) @endforeach
{{-- /sfDeliveryAddressSection --}}
@endif

Coupon

Payment method

@foreach($enabledMethods as $method) @php $icon = $methodIcons[$method] ?? null; @endphp @endforeach
@endsection