In Magento 1.x I did it like this:
$_product = ...; // some product object you already have
$_productCollection = Mage::helper('wishlist')->getProductCollection()
->addFieldToFilter('sku', $_product->getSku());
if($_productCollection->count() > 0) {
// User already has item in wishlist.
}
How can I achieve the same in Magento 2?
Best Answer
As far as I know, we can use
\Magento\Wishlist\Helper\Data
to check if a product is already on the wishlist.Remember to inject this class in your construction.