@extends('frontend.layouts.app', ['title' => '']) @section('content')
@foreach ($banners as $banner)
@endforeach
@foreach ($categories as $category) @php $countProduct = 0; // Count products directly in the main category $countProduct += $category ->products() ->whereHas('variations', function ($query) { $query->where('is_deleted', 0); // or whatever your availability field is // OR if you check stock quantity: // $query->where('stock', '>', 0); }) ->where('is_deleted', 0) ->count(); // Count products in subcategories foreach ($category->sub_categories as $subCat) { $countProduct += $subCat ->products() ->whereHas('variations', function ($query) { $query->where('is_deleted', 0); // or whatever your availability field is // OR if you check stock quantity: // $query->where('stock', '>', 0); }) ->where('is_deleted', 0) ->count(); } @endphp @if ($countProduct > 0)
{{ $countProduct }} items
@endif @endforeach
{{--
--}}

NEW DROP's IN

{{--

Wait there's more

--}}
Free shipping

Free shipping on every order

7 days returns

Moneyback guarantee

Secure payment

100% protected payment

Online support

24/7 days a week support

@if (count($best_seller_products) > 0)

WAIT THERE's MORE

@livewire('product-list')
@endif @endsection