DEV Community

Remon Hasan
Remon Hasan

Posted on

Shopping Cart Laravel 8: part 03

Alt Text

Source Code

Github

Add to cart

Now we have to pick the add to cart of product by using wire bind as like:

wire:click.prevent="store({{$product->id}},'{{$product->name}}',{{$product->regular_price}})"

Additionally, we can use the method of count() for checking there is any product or not! For that we can use the loop like:

@if(Cart::count()>0)
// go for product
else
No Products
@endif

Fetch product image from database

src="{{asset('assets/images/products')}}/{{$item->model->image}}"

Route action

href="{{route('product.details',['slug'=>$item->model->slug])}}"

Rest of the functions of building cart package

  1. Subtotall
  2. Total
  3. Tax

Alt Text

Top comments (0)