@if (checkCustomerLogged())
Default Shipping Address: @php $defaultAddress = $shippingAddresses ? $shippingAddresses->firstWhere('is_default', 1) : null; @endphp {{ $defaultAddress ? $defaultAddress->nickname : 'No Default Address Set' }}
Select Shipping Address:
@endif
@csrf @if (getAllProductFromCart()) {{-- @dd(getAllProductFromCart()) --}} @foreach (getAllProductFromCart() as $key => $cart) @if ($cart->get_free_quantity > 0) {{-- --}} @endif @endforeach @else @endif
PRODUCT NAME UNIT PRICE QUANTITY TOTAL
{{ $cart->product->featured_image?->getUrl() }}

{{ $cart->product['name'] }}

@if (isset($cart->options) && count($cart->options) > 0)

@foreach ($cart->options as $cartItem) {!! $cartItem->input_label !!}: @if ($cartItem->input_type === 'file' && $cartItem->input_value) @php $decoded = json_decode($cartItem->input_value, true); $fileUrls = is_array($decoded) ? $decoded : explode(',', $cartItem->input_value); @endphp @foreach ($fileUrls as $index => $fileUrl) View File {{ $index + 1 }} @if (!$loop->last) | @endif @endforeach @else {{ $cartItem->selected_label }} @endif
@endforeach

@endif

{!! $cart['summary'] !!}

@if (checkCustomerLogged())
shipping_address_id == null ? '' : 'checked' }}>
@else @endif
@php $originalUnitPrice = $cart['real_price']; $discountedUnitPrice = collect( session('applied_coupon')['discounted_products'] ?? [], )->firstWhere('id', encrypt_decrypt('encrypt', $cart->id))[ 'new_unit_price' ] ?? $originalUnitPrice; @endphp {{-- @if ($cart['real_price'] == $cart['price']) @if ($originalUnitPrice != $discountedUnitPrice) ${{ number_format($originalUnitPrice) }} ${{ number_format($discountedUnitPrice) }} @endif @endif --}} @if ($cart['real_price'] != $cart['price']) ${{ number_format($cart['real_price'],2) }} ${{ number_format($cart['price'],2) }} @else ${{ number_format($originalUnitPrice,2) }} @endif
${{ number_format($cart['amount'],2) }}
{{ $cart->product->featured_image?->getUrl() }}

{{ $cart->product['name'] }} (Free)

Free {{ $cart->get_free_quantity }}
-
There are no any carts available. Continue shopping
@php $appliedCoupon = session('applied_coupon'); $isCouponApplied = $appliedCoupon && $appliedCoupon['user_id'] == Auth::id(); @endphp
@if (!$isCouponApplied)
@csrf
@else
✅ Coupon applied successfully: {{ $appliedCoupon['code'] }}
@endif
{{--
` @php $shipping=DB::table('shippings')->where('status','active')->limit(1)->get(); @endphp
--}}
  • Cart Subtotal${{ number_format(totalCartPrice(), 2) }}
  • {{-- --}} @php $userId = Auth::id(); $sessionId = session()->get('session_id'); $cartItems = \App\Models\Cart::where(function ($query) use ($userId, $sessionId) { if ($userId) { $query->where('user_id', $userId); } else { $query->where('session_id', $sessionId); } })->whereNull('order_id')->get(); $totalOriginalPrice = $cartItems->sum('real_amount'); $totalDiscountedPrice = $cartItems->sum('amount'); $totalSaved = max($totalOriginalPrice - $totalDiscountedPrice, 0); $couponDiscount = 0; if (session()->has('applied_coupon')) { $couponData = session('applied_coupon'); $couponDiscount = isset($couponData['discount_amount_type_2']) ? (float) str_replace(',', '', $couponData['discount_amount_type_2']) : 0; } $totalSaved += $couponDiscount; @endphp {{-- @dd($totalDiscountedPrice) --}} @if ($totalSaved > 0)
  • You Save: ${{ number_format($totalSaved, 2) }}
  • @endif {{-- @php $total_amount = totalCartPrice(); if (session()->has('coupon')) { $total_amount = $total_amount - Session::get('coupon')['value']; } @endphp @if (session()->has('coupon'))
  • You Pay${{ number_format($total_amount, 2) }}
  • @else
  • You Pay${{ number_format($total_amount, 2) }}
  • @endif --}}
  • You Pay @php $couponDiscountType2 = session()->get( 'applied_coupon.discount_amount_type_2', null, ); $finalPrice = isset($couponDiscountType2) ? max( $totalDiscountedPrice - (float) str_replace(',', '', $couponDiscountType2), 0, ) : $totalDiscountedPrice; @endphp ${{ number_format($finalPrice, 2) }}