ORDER ITEMS
@if($items->isEmpty())
No item details are available for this order.
@else
@foreach(['Product', 'SKU', 'Qty', 'Unit price', 'Discount', 'Tax', 'Total'] as $heading) @endforeach @foreach($items as $item) @php $metadata = $item->metadata ?? []; $name = data_get($metadata, 'product_name', $item->item_name_snapshot ?: 'Item'); $sku = data_get($metadata, 'variant_sku', data_get($metadata, 'sku')); $unitPrice = $item->final_price ?? $item->sale_price ?? $item->original_price ?? 0; $total = (float) $item->line_total - (float) $item->discount_amount + (float) $item->tax_amount; @endphp @endforeach
{{ $heading }}
{{ $name }} {{ filled($sku) ? $sku : '—' }} {{ $item->quantity }} {{ $currencySymbol }}{{ number_format((float) $unitPrice, 2) }} {{ $currencySymbol }}{{ number_format((float) ($item->discount_amount ?? 0), 2) }} {{ $currencySymbol }}{{ number_format((float) ($item->tax_amount ?? 0), 2) }} {{ $currencySymbol }}{{ number_format($total, 2) }}
@endif