Giỏ hàng của bạn

@if($cartItems->isEmpty())

Giỏ hàng của bạn hiện tại trống.

@else @foreach($cartItems as $item)
@csrf @method('DELETE')
{{ $item->product->product_name }}
{{ Str::limit($item->product->product_name, 30, '...') }}
{{ $item->quantity }}
@php $unitPrice = $item->product->is_sale ? $item->product->sale_price : $item->product->price; @endphp

Đơn giá: {{ number_format($unitPrice * $item->quantity) }}₫

@endforeach

Tổng cộng: @php $total = $cartItems->sum(function($item) { $unitPrice = $item->product->is_sale ? $item->product->sale_price : $item->product->price; return $unitPrice * $item->quantity; }); @endphp {{ number_format($total, 0, ',', '.') }} đ

@endif