How to Get Multiple Wishlist Data by Wishlist Name in Magento 2 Enterprise?

Get Wishlist by Name in Magento 2 Enterprise

Today we will talk about, How to get multiple wishlist data by wishlist name in the magento2 enterprise edition project.

As you know, in Magento 2 enterprise edition, customers can create multiple wishlists at their convenience. With multiple wishlists, users can easily categorize and organize their desired products. It also allows them to share specific lists with friends or family conveniently.

We can easily fetch wishlists by specific customer and wishlist name programmatically.

We can achieve this using Magento\Wishlist\Model\ResourceModel\Wishlist\CollectionFactory.

One customer is logged in and has a “Vacation Wants” wishlist. Let’s see how we can get this wishlist data programmatically.

Magento 2 Enterprise Edition - Multiple Wishlist

We will create a function named getCustomerWishListByName() and specify 2 parameters: customerId and Wishlist Name.

In your template file or any suitable place, you can call this function and get a wishlist as shown below.

This will output the wishlist item Name and Product ID, you can get additional product details as per your requirement.

That’s It… I hope this tutorial is helpful.

Please share it with your teammates and friends.

Do not forget to comment on your queries and feedback in the comment box.

You can also check,

Add Yes/No Attribute in Magento 2 programmatically

How to remove/disable add to compare in Magento 2?

How to Show/Hide one field based on another field in UI Component forms in Magento 2?

Leave a Reply

Your email address will not be published. Required fields are marked *