@extends('frontend.layout.app') @section('content')

Checkout

Address Details

@php $user = auth()->user(); @endphp
Name {{ $user?->first_name }}
Mobile {{ $user?->phone }}
Email {{ $user?->email }}
{{-- Delivery Addresses --}}
@if ($user && $user->addresses && $user->addresses->count()) @foreach ($user->addresses as $address)
first ? 'checked' : '' }}>
{{ $address->name }}
{{ $address->address }}, {{ $address->city }}, {{ $address->state }} ({{ ucfirst($address->address_type) }})
Pin: {{ $address->pincode }}
{{ $address->phone }} @if ($address->email)
{{ $address->email }} @endif
@csrf @method('DELETE')
@endforeach {{-- Edit Popup --}} @else

No address found. Please add your shipping address.

@endif
{{-- Add address form --}}
@csrf
{{-- End add address accordion --}}
{{-- Right side: Order summary --}}

Your Order

@csrf @php $subtotal = 0; $totalGst = 0; @endphp @foreach ($cartItems as $cart) @php $basePrice = (float) ($cart->sp ?? 0); $isVendorItem = !empty($cart->vendor_product_id) && $cart->vendorProduct; $platformFee = $isVendorItem ? ($basePrice * 0.10) : 0; $gstRate = 0; if ($isVendorItem && isset($cart->vendorProduct->gst)) { $gstRate = $cart->vendorProduct->gst; } elseif (isset($cart->product->gst)) { $gstRate = $cart->product->gst; } $gstAmount = $gstRate > 0 ? ($basePrice * $gstRate) / 100 : 0; $totalGst += $gstAmount * $cart->quantity; $effectiveUnitPrice = $basePrice + $platformFee + $gstAmount; $itemTotal = $effectiveUnitPrice * $cart->quantity; $subtotal += $itemTotal; $itemProduct = $cart->product; $itemVendor = $cart->vendorProduct; $isVendorItem = !empty($cart->vendor_product_id); $itemName = $itemVendor->product_name ?? $itemProduct->product_name ?? 'Product Not There'; $itemUrl = $isVendorItem && $itemVendor ? route('vendor.productsdetails', $itemVendor->id) : route('productsdetails', $itemProduct?->id ?? 0); $fallbackImage = asset('frontend/assets/img/product/default.png'); if ($isVendorItem && $itemVendor && $itemVendor->images && $itemVendor->images->first()) { $imgPath = $itemVendor->images->first()->image ?? null; $imgPath = ltrim((string) $imgPath, '/'); if (str_starts_with($imgPath, 'storage/')) { $imgPath = substr($imgPath, strlen('storage/')); } if (str_starts_with($imgPath, 'public/')) { $imgPath = substr($imgPath, strlen('public/')); } $itemImageUrl = $imgPath ? asset('storage/' . $imgPath) : $fallbackImage; } else { $productImage = $itemProduct && $itemProduct->images ? $itemProduct->images->first() : null; $itemImageUrl = $productImage ? asset('storage/product/' . $productImage->images) : $fallbackImage; } @endphp @endforeach @if (count($cartItems) == 0) @endif {{-- Product Discounts --}} @php $totalProductDiscount = 0; $productDiscountsDetail = []; foreach ($cartItems as $cartitem) { if (empty($cartitem->vendor_product_id) && isset($cartitem->product->discount) && $cartitem->product->discount > 0) { $discountPercent = $cartitem->product->discount; $itemTotal = $cartitem->sp * $cartitem->quantity; $itemProdDiscount = ($discountPercent / 100) * $itemTotal; $totalProductDiscount += $itemProdDiscount; $productDiscountsDetail[] = [ 'name' => $cartitem->product->product_name, 'percent' => $discountPercent, 'value' => $itemProdDiscount, ]; } } @endphp @if ($totalProductDiscount > 0) @endif {{-- GST --}} @php $gstAmount = 0; $hasGst = false; foreach ($cartItems as $cartitem) { $itemGstSource = null; if (empty($cartitem->vendor_product_id) && isset($cartitem->product->gst)) { $itemGstSource = $cartitem->product->gst; } if ($itemGstSource !== null && $itemGstSource > 0) { $hasGst = true; $itemGstRate = $itemGstSource / 100; $itemGst = $cartitem->sp * $cartitem->quantity * $itemGstRate; $gstAmount += $itemGst; } } @endphp {{-- Coupon Discount --}} @php $couponDiscount = isset($coupon_discount) ? $coupon_discount : session('coupon_discount', 0); $appliedCoupon = isset($applied_coupon) ? $applied_coupon : session('applied_coupon'); @endphp @if ($couponDiscount && $couponDiscount > 0) @endif @php $grandTotal = max( 0, $subtotal - $totalProductDiscount - $couponDiscount, ); @endphp
Image Product Name Price Qty Total
{{ $itemName }} {{ $itemName }} {{ number_format($effectiveUnitPrice, 2) }} {{ $cart->quantity }} {{ number_format($itemTotal, 2) }}
No products in your cart.
Subtotal {{ number_format($subtotal, 2) }}
Shipping Free Shipping
Product Discounts -{{ number_format($totalProductDiscount, 2) }}
@foreach ($productDiscountsDetail as $pd)
{{ $pd['name'] }}: {{ rtrim(rtrim(number_format($pd['percent'], 2), '0'), '.') }}% (₹{{ number_format($pd['value'], 2) }})
@endforeach
Coupon Discount -{{ number_format($couponDiscount, 2) }}
Coupon {{ $appliedCoupon }} applied Remove
Total {{ number_format($grandTotal, 2) }}
@endsection