I'm trying to get the multiple wishlist by customer_id, but not work
protected $wishlistCollectionFactory;
--constructor
\Magento\Wishlist\Model\ResourceModel\Wishlist\CollectionFactory $wishlistCollectionFactory
.......
$this->wishlistCollectionFactory = $wishlistCollectionFactory;
actual code in controller
if ($action == "wishlist") {
$customer_id = $this->customerSession->getCustomer()->getId();
//var_dump($customer_id);
$wishlistCollection = $this->wishlistCollectionFactory->create()->addFieldToFilter('customer_id', $customerId);;
var_dump(json_encode($wishlistCollection));
$result->setData(['error' => 0,
'message' => __('Operation Success'),
'wishlistCollection' => json_encode($wishlistCollection)
]
);
return $result;
}
the output of wishlist is null, anyone know how to get the wishlist collection in commerce edition?
i want to get the all wishlist names.