/** * Retrieve current wishlist * @param string $wishlistId * @return \Magento\Wishlist\Model\Wishlist */ public function getWishlist($wishlistId = null) { if ($this->wishlist) { return $this->wishlist; } $code = (string) $this->request->getParam('code'); if (empty($code)) { return false; } $wishlist = $this->wishlistFactory->create()->loadByCode($code); if (!$wishlist->getId()) { return false; } $this->checkoutSession->setSharedWishlist($code); $this->wishlist = $wishlist; return $wishlist; }