In this video we are going to learn about Adding Product To the Wishlist
So let see how can we Add Product To Wishlist.
First of all lets add an icon on every product from where we can add the product to the wishlist.
So for that switch to the project and open shop-component.blade.php file.
Inside this foreach add the following code.

<div class=\"product_wish\">
<a href=\"#\"><i class=\"fa fa-heart\"></i></a>
</div>

Now lets add some css for this icon

So here add the style tag
All right now lets check it
So switch to browser and refresh the page
Now you can see here a heart icon on each product
Alright, now lets make this link working
So for that go to ShopComponent Class file
Here lets create a function for adding the product to the wishlist

<style>
.product-wish{
position: absolute;
top:10%;
left:0;
z-index:99;
right:30px;
text-align:right;
padding-top: 0;
}
.product-wish .fa{
color:#cbcbcb;
font-size:32px;
}
.product-wish .fa:hover{
color:#ff7007;
}
.fill-heart{
color:#ff7007 !important;
}
</style>


Now go to ShopComponent.php class file create a function for adding product to wishlist.

public function addToWishlist($product_id,$product_name,$product_price)
{
Cart::instance('wishlist')->add($product_id,$product_name,1,$product_price)->associate('App\\Models\\Product');
}


Now go to the shop-component.blade.php file call addToWishlist function.


<a href=\"#\" wire:click.prevent=\"addToWishlist({{$product->id}},'{{$product->name}}',{{$product->regular_price}})\"><i class=\"fa fa-heart\"></i></a>



Now go to the base layout file.
Lets find the wishlist icon add the following code.


<div class=\"wrap-icon-section wishlist\">
<a href=\"#\" class=\"link-direction\">
<i class=\"fa fa-heart\" aria-hidden=\"true\"></i>
<div class=\"left-info\">
@if(Cart::instance('wishlist')->count() > 0)
<span class=\"index\">{{Cart::instance('wishlist')->count()}} item</span>
@endif
<span class=\"title\">Wishlist</span>
</div>
</a>
</div>


Now its done lets check it.
Before checking it do one thing.
For Cart set the instance.
So go to the ShopComponent.php class file.
And here add the instace for Cart like this Cart::instance('cart') every where.
Now go to the CartComponent Class file and here also add the instance for the cart.
Now go to the CartComponent view file and add here the cart instance.
Now go to the base layout file here also add the instance for the cart.
Alright now all done so lets check it.
So switch to the browser.
And refresh the page.
And now lets add product to the wishlist.
So lets click on this link for adding this product in wishlist.
Now you can see here the color has been changed of this heart and here.
It should be showing the no of wishlisted product, but it not showing.
Ok if I refresh the page you can see here the no of records in whishlist.
So in this way you can add the product to the wishlist.
In next tutorial we will see how to auto refresh this wishlist count.