@php $layout = $isMobile ? 'layouts.mobile' : 'layouts.desktop'; $totalOriginalPrice = 0; foreach($cartItems as $item) { $originalPrice = $item->product->price * $item->quantity; $totalOriginalPrice += $originalPrice; } $discount = $totalOriginalPrice - $total; @endphp @extends($layout) @section('title', 'Shopping Cart - Gletra') @push('styles') @endpush @section('content')
@if($cartItems->count() > 0)
My Cart ({{ $cartItems->sum('quantity') }})
@foreach($cartItems as $item) @php $imgSrc = $item->product->getPrimaryImage(); $itemOriginalPrice = $item->product->price * $item->quantity; $itemSellingPrice = $item->price * $item->quantity; $discountPercent = $item->product->price > 0 ? round((($item->product->price - $item->price) / $item->product->price) * 100) : 0; @endphp
{{ $item->product->name }}
@if(!empty($item->product->slug)) {{ $item->product->name }} @else {{ $item->product->name }} @endif
Seller: {{ $item->product->vendor->shop_name ?? 'Gletra Seller' }}
₹{{ number_format($item->price, 0) }} ₹{{ number_format($item->product->price, 0) }} {{ $discountPercent }}% Off
@if($item->variant)
{{ $item->variant->name }}
@endif
Delivery by {{ now()->addDays(3)->format('D M d') }} | Free
@csrf @method('PATCH')
@csrf @method('PATCH')
@csrf
@csrf @method('DELETE')
@endforeach
Price Details
Price ({{ $cartItems->sum('quantity') }} items) ₹{{ number_format($totalOriginalPrice, 0) }}
Discount - ₹{{ number_format($discount, 0) }}
Delivery Charges FREE
Total Amount ₹{{ number_format($total, 0) }}
You will save ₹{{ number_format($discount, 0) }} on this order
Safe and Secure Payments. 100% Authentic products.
@else
Empty Cart

Your cart is empty!

Add items to it now.

Shop Now
@endif
@if(isset($recentlyViewed) && $recentlyViewed->count() > 0)
More Items to Consider
@foreach($recentlyViewed as $rv) @if($rv->product)
{{ $rv->product->name }}
₹{{ number_format($rv->product->sale_price ?? $rv->product->price, 0) }}
@endif @endforeach
@endif
@endsection