Skip to main content
deleted 37 characters in body
Source Link

Try This

protected $_wishlistCollectionFactory;

    public function __construct(
    ...
    Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory $wishlistCollectionFactory
    ) {
    $this->_wishlistCollectionFactory = $wishlistCollectionFactory;
    ...
    }

    
    public function getProductCollection()
    {
            
            $wishlist = $this->_wishlistCollectionFactory->create()->addFieldToFilter('wishlist_id', $wishlist->getId());            

            foreach ($wishlist as $product) {
                echo "<pre>";
                print_r($product->getData());
                echo "</pre>";
            }
            die();    
        return $collection;
    }

Try This

protected $_wishlistCollectionFactory;

    public function __construct(
    ...
    Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory $wishlistCollectionFactory
    ) {
    $this->_wishlistCollectionFactory = $wishlistCollectionFactory;
    ...
    }

    
    public function getProductCollection()
    {
            
            $wishlist = $this->_wishlistCollectionFactory->create()->addFieldToFilter('wishlist_id', $wishlist->getId());            

            foreach ($wishlist as $product) {
                echo "<pre>";
                print_r($product->getData());
                echo "</pre>";
            }
            die();    
        return $collection;
    }

Try This

protected $_wishlistCollectionFactory;

    public function __construct(
    ...
    Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory $wishlistCollectionFactory
    ) {
    $this->_wishlistCollectionFactory = $wishlistCollectionFactory;
    ...
    }

    
    public function getProductCollection()
    {
            
            $wishlist = $this->_wishlistCollectionFactory->create()->addFieldToFilter('wishlist_id', $wishlist->getId());            

            foreach ($wishlist as $product) {
                echo "<pre>";
                print_r($product->getData());
                echo "</pre>";
            }
            die();
    }
Source Link

Try This

protected $_wishlistCollectionFactory;

    public function __construct(
    ...
    Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory $wishlistCollectionFactory
    ) {
    $this->_wishlistCollectionFactory = $wishlistCollectionFactory;
    ...
    }

    
    public function getProductCollection()
    {
            
            $wishlist = $this->_wishlistCollectionFactory->create()->addFieldToFilter('wishlist_id', $wishlist->getId());            

            foreach ($wishlist as $product) {
                echo "<pre>";
                print_r($product->getData());
                echo "</pre>";
            }
            die();    
        return $collection;
    }