0

I need a way to get a list of customers that have a wishlist.

Thanks in advanced.

1 Answer 1

0

You can load all customer and get customer have wishlist or not

currently i have pass one customer have static customer id , you can use that code by all customer

$customerId = 1; //Customer Id
$wishlistColl = $block->getWishlistByCustId($customerId);
if(count($wishlistColl)) {
    foreach ($wishlistColl as $_item) {
        echo $_item->getProduct()->getName();echo "<br>";
        echo $_item->getProduct()->getId();echo "<br>";
    }
} else {
    echo __("No Item found in wishlist");
}

For Wishlist collection

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$wishlist = $objectManager->get('\Magento\Wishlist\Model\Wishlist');

you can load by customer id in that loadByCustomerId

Hope this will help you

Your Answer

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

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