diff --git a/packages/Webkul/Customer/src/Helpers/Wishlist.php b/packages/Webkul/Customer/src/Helpers/Wishlist.php index 039b54c40..405417a1c 100644 --- a/packages/Webkul/Customer/src/Helpers/Wishlist.php +++ b/packages/Webkul/Customer/src/Helpers/Wishlist.php @@ -43,9 +43,9 @@ class Wishlist } if ($wishlist) { - return true; + return $wishlist; } - return false; + return null; } } \ No newline at end of file diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/wishlist.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/wishlist.blade.php index acb9e4388..66573a0a1 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/products/wishlist.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/wishlist.blade.php @@ -4,22 +4,22 @@ @auth('customer') @php - $isWished = $wishListHelper->getWishlistProduct($product); + /* search wishlist on the basis of product's id so that wishlist id can be catched */ + $wishlist = $wishListHelper->getWishlistProduct($product); + + /* link making */ + $href = isset($route) ? $route : ($wishlist ? route('customer.wishlist.remove', $wishlist->id) : route('customer.wishlist.add', $product->product_id)); + + /* title */ + $title = $wishlist ? __('velocity::app.shop.wishlist.remove-wishlist-text') : __('velocity::app.shop.wishlist.add-wishlist-text'); @endphp + href="{{ $href }}" + title="{{ $title }}"> - + @if (isset($text)) {!! $text !!}