@extends('layouts.shop') @section('title', 'My Wishlist') @section('content')
@include('user.partials.sidebar')

My Wishlist

@if($wishlists->count() > 0)
@foreach($wishlists as $item)
@php $img = null; $mainImage = $item->product->images->sortBy('sort_order')->first(); if ($mainImage) { $img = $mainImage->image_path; } else { if ($item->product->variations->isNotEmpty()) { $img = $item->product->variations->first()->image_path; } } $imagePath = $img ? $img : 'https://placehold.co/500x500?text=No+Image'; $isOutOfStock = true; if ($item->product->variations->sum('stock') > 0) { $isOutOfStock = false; } @endphp {{ $item->product->name }}
@csrf @method('DELETE')
@if(!$isOutOfStock)
@csrf
@else
OUT OF STOCK
@endif

{{ $item->product->name }}

@php $minPrice = $item->product->variations->min('sp'); $totalStock = $item->product->variations->sum('stock'); $threshold = $settings->min_stock_threshold ?? 5; @endphp

₹{{ number_format($minPrice, 2) }}

@if($isOutOfStock)

Unavailable

@elseif($totalStock <= $threshold)

Low Stock

@else

In Stock

@endif
@endforeach
@else

Your wishlist is empty

Start saving your favorite items to find them easily later.

Start Shopping
@endif
@endsection