How can I get a customer wishlist product id's or sku's collection in phtml file in magento 2.

  • for all customer or particular customer ? – Keyur Shah Nov 15 '16 at 12:06

Use below code to get wishlist from customer id

So update your class constructor like below:

    protected $_wishlistRepository;

    public function __construct(
        \Magento\Wishlist\Model\WishlistFactory $wishlistRepository
    ) {
        $this->_wishlistRepository= $wishlistRepository;

Add below code for wishlist item collection

$wishlist = $this->_wishlistRepository->create()->loadByCustomerId($customerId, true);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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