{{-- resources/views/storefront/cart.blade.php --}} @extends('storefront.layout') @section('title', trans_key('storefront.pageTitles.cart').' - '.config('app.name', 'FreshMart')) @section('body_class', 'sf-app-cart-body') @section('content') @php $items = $cart?->items ?? collect(); $summary = $summary ?? []; $subtotal = (float) data_get($summary, 'subtotal', 0); $discount = (float) data_get($summary, 'discount_total', data_get($summary, 'coupon_discount_total', 0)); $couponDiscount = (float) data_get($summary, 'coupon_discount_total', 0); $comboDiscount = (float) data_get($summary, 'combo_discount_total', 0); $deliveryFee = (float) data_get($summary, 'delivery_fee', 0); $platformFee = (float) data_get($summary, 'platform_fee', 0); $taxTotal = (float) data_get($summary, 'tax_total', 0); $payableAmount = (float) data_get($summary, 'payable_amount', $cartTotal ?? 0); $itemQuantity = (int) $items->sum('quantity'); $isGrocery = ($selectedService ?? 'grocery') !== 'food'; $freeDeliveryRemaining = $freeDeliveryThreshold !== null ? max(0, (float) $freeDeliveryThreshold - (float) ($cartTotal ?? $subtotal)) : null; $freeDeliveryProgress = $freeDeliveryThreshold ? min(100, max(8, (((float) ($cartTotal ?? $subtotal)) / max(1, (float) $freeDeliveryThreshold)) * 100)) : 0; $storeLogo = $cart?->store ? \App\Support\StorefrontPresenter::storeLogo($cart->store) : null; @endphp
{{ $itemQuantity }} item{{ $itemQuantity === 1 ? '' : 's' }} in cart
@if($cart?->store?->is_open) Open and accepting orders @endif{{ session('delivery_location', 'Select delivery location') }}
{{ $item->productVariant?->name ?: 'Regular' }}