Merge pull request #5068 from devansh-webkul/wishlist_issue

Is Wishlist API Key Fixed #5067
This commit is contained in:
Glenn Hermans 2021-08-12 14:03:55 +02:00 committed by GitHub
commit 41f74990fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -14,7 +14,9 @@ class Wishlist
{
$wishlist = false;
if ($customer = auth()->guard('customer')->user()) {
$guard = request()->has('token') ? 'api' : 'customer';
if ($customer = auth()->guard($guard)->user()) {
$wishlist = $customer->wishlist_items->filter(function ($item) use ($product) {
return $item->channel_id == core()->getCurrentChannel()->id && $item->product_id == $product->product_id;
})->first();