<p>You can pass a list type handle in the query like this:</p>
<pre><code>{% set compare = craft.wishlist.item(entry.id, null, 'compare') %}
</code></pre>
<p>I had to look at the <a href="https://github.com/verbb/wishlist/blob/craft-3/src/variables/WishlistVariable.php" rel="nofollow noreferrer">source code</a> for the <code>craft.wishlist</code> variable to confirm what that's doing, though! The <a href="https://verbb.io/craft-plugins/wishlist/docs/template-guides/managing-items#check-if-in-list" rel="nofollow noreferrer">Wishlist docs on checking if an item is in a list</a> aren't super-clear on this, but passing the list type handle in the query will fetch the <em>first</em> list that matches that handle for the current user. If you have multiple lists for that list type, only the first one that the query returns will be checked for the item.</p>

CC BY-SA 4.0
2022-09-20T11:16:50.323Z
I think this searches through all items of all users. Not sure if you want that.
Volker Andres
CC BY-SA 4.0
2020-11-10T14:46:03.630Z
2020-11-10T14:46:03.630Z
Martin Spain
<p>Looking at the docs, it says to check if an item is in wishlist using the below code:</p>
<pre><code>{% set compare = craft.wishlist.item(entry.id) %}
{% if compare.inList %}
    &lt;a class=&quot;&quot; href=&quot;{{ compare.addUrl() }}&amp;fields[linkTo]={{ entry.url }}&amp;listTypeHandle=compare&quot;&gt;Remove from Compare&lt;/a&gt;
{% else %}
    &lt;a class=&quot;&quot; href=&quot;{{ compare.removeUrl() }}&amp;fields[linkTo]={{ entry.url }}&amp;listTypeHandle=compare&quot;&gt;Compare&lt;/a&gt;
{% endif %}
</code></pre>
<p>I want to do the above but tell it what list to look in i.e craft.wishlist.type('compare').item(entry.id)</p>
<p>I cannot see how on earth to do this. I have multiple lists that an entry could be in, so need to specify.</p>
<p>Any help would be very gratefully received!!</p>

<plugins>
Verbb Wishlist plugin see if item is in specific list
# Verbb Wishlist plugin see if item is in specific list

(Asked by: username_0 on 2020-11-09)

Looking at the docs, it says to check if an item is in wishlist using the below code:
{% set compare = craft.wishlist.item(entry.id) %}
{% if compare.inList %}
    Remove from Compare
{% else %}
    Compare
{% endif %}

I want to do the above but tell it what list to look in i.e craft.wishlist.type('compare').item(entry.id)
I cannot see how on earth to do this. I have multiple lists that an entry could be in, so need to specify.
Any help would be very gratefully received!!

**Tags:** plugins


---

## 1 answers

### Answer by username_1 on 2020-11-10. Score: 2

You can pass a list type handle in the query like this:
{% set compare = craft.wishlist.item(entry.id, null, 'compare') %}

I had to look at the source code for the craft.wishlist variable to confirm what that's doing, though! The Wishlist docs on checking if an item is in a list aren't super-clear on this, but passing the list type handle in the query will fetch the first list that matches that handle for the current user. If you have multiple lists for that list type, only the first one that the query returns will be checked for the item.

> **Comments:**
> **username_2**: I think this searches through all items of all users. Not sure if you want that.  

---

