@php $currency = currency_code( $cart->currency_code ?? null ); /* * Keep these as raw numeric values. * The money() helper performs the final formatting. */ $summarySubtotal = (float) ($subtotal ?? 0); $summaryShipping = (float) ($shippingCost ?? 0); $summaryTotal = (float) ($estimatedTotal ?? 0); $physicalProducts = (bool) ( $hasPhysicalProducts ?? false ); $cartItems = $cart->items ?? collect(); $itemsCount = $cartItems->count(); $quantityTotal = $cartItems->sum( static function ($item): int { return max( 0, (int) ($item->quantity ?? 1) ); } ); $shippingQuotesAvailable = ! empty($quotes); @endphp