@php $variants = $product->variants ?? collect(); $inStock = $variants->where('in_stock', true); $minPrice = $inStock->min('price') ?? 0; $maxPrice = $inStock->max('price') ?? 0; $allColors = $inStock->whereNotNull('color_code')->unique('color_code')->values(); $isOutOfStock = $inStock->isEmpty(); // Discount: compare max price to min price (printful products vary by color/size) $hasRange = $minPrice !== $maxPrice; @endphp