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 %}
    <a class="" href="{{ compare.addUrl() }}&fields[linkTo]={{ entry.url }}&listTypeHandle=compare">Remove from Compare</a>
{% else %}
    <a class="" href="{{ compare.removeUrl() }}&fields[linkTo]={{ entry.url }}&listTypeHandle=compare">Compare</a>
{% 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!!

1 Answer 1


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.

  • I think this searches through all items of all users. Not sure if you want that. Sep 20, 2022 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.