In this video we are going to learn about Remove Product from Wishlist.
So let see how can we Remove Product from Wishlist.
Switch to the project and lets open the ShopComponent.php class file.
And here lets create a function for removing product from wishlist.

public function removeFromWishlist($product_id)
{
foreach(Cart::instance('wishlist')->content() as $witem)
{
if($witem->id == $product_id)
{
Cart::instance('wishlist')->remove($witem->rowId);
$this->emitTo('wishlist-count-component','refreshComponent');
return;
}
}
}


Now go to the shop-component.blade.php view file.
Here lets call the removeFromWishlist function on click action.

<div class=\"product-wish\">
@if($witems->contains($product->id))
<a href=\"#\" wire:click.prevent=\"removeFromWishlist({{$product->id}})\"><i class=\"fa fa-heart fill-heart\"></i></a>
@else
<a href=\"#\" wire:click.prevent=\"addToWishlist({{$product->id}},'{{$product->name}}',{{$product->regular_price}})\"><i class=\"fa fa-heart\"></i></a>
@endif
</div>


Now its done. So lets check it.
So switch to the browser and refresh the page.
Now lets add any product to wishlist.
So here I am going to add this product to wishlist.
So click on this link.
You can see here heart colour is changed it means product has been added to the wishlist.
And here you see the no of wishlisted product is 1.
Add one more product.
So lets click on this.
Product added and here see no of product 2.
Now lets remove the product from the wishlist.
So lets click on this link for removing the product from wishlist.
And you can see heart icon color is changed from orange to grey.
It means product has been removed from the wishlist.
And here you can see no of product in wishlist is 1.
Now remove this product also, product has been removed and here wishlist is now empty.
So in this way you can remove product from wishlist.