@if ($order->orderItems->isNotEmpty())
@php $total = 0; @endphp
{{-- Order Items Row --}}
@foreach ($order->orderItems as $item)
{{-- Product Image --}}
-
{{-- Product Info --}}
-
Price: {{ $item->product_name }}
@php
$mrp = $item->variation->mrp;
$price = $item->variation->price;
$percentOff = $mrp > 0 && $price > 0
? round((($mrp - $price) / $mrp) * 100)
: 0;
@endphp
{{ $percentOff }}% off
MRP₹{{ $mrp }}
₹{{ $price }}
@if ($item->variation->variation_attributes->isNotEmpty())
{{ $item->variation->variation_attributes->map(function ($attribute) {
return $attribute->attribute->attribute->name . ': ' . $attribute->attribute->name;
})->implode(', ') }}
@endif
{{ $item->quantity }} Item{{ $item->quantity > 1 ? 's' : '' }}:
₹{{ $item->variation->price * $item->quantity }}
@php
$total += $item->variation->price * $item->quantity;
@endphp
@endforeach
{{-- ✅ Total AFTER the loop --}}
Total: ₹{{ $total }}
@endif
{{-- Shipping Address Row --}}
{{ $order->address->house_no }}
{{ $order->address->society }}
{{ $order->address->city }}
{{ $order->address->state }}
{{ $order->address->pincode }}