@forelse($products as $product) @php $stocks = $product->stocks; $firstStock = optional($stocks->first()); $hasVariants = $stocks->count() > 1; $thumb = $product->thumbnail_img ? uploaded_asset($product->thumbnail_img) : static_asset('assets/img/placeholder.jpg'); $totalStock = $hasVariants ? $stocks->sum('qty') : ($firstStock->qty ?? 0); @endphp {{-- If sidebar is open then class should be different --}}
@if(!$product->digital) {{ translate('Stock') }}: {{ $totalStock }} @endif
{{ $product->getTranslation('name') }}
{{ translate('SKU') }}: {{ $firstStock->sku ?? translate('N/A') }}
@if($hasVariants)
@endif
{{--
--}} {{ home_discounted_base_price($product) }} @if($totalStock > 0) @if($hasVariants) @else @endif @else @endif
@empty
{{ translate('No products found for your filters') }}
@endforelse