---
title: "How to Get Wishlist Data Using Customer ID in Magento 2"
url: "https://magecomp.com/blog/get-wishlist-data-using-customer-id-magento-2/"
date: "2023-06-23T15:37:21+00:00"
modified: "2025-02-13T12:32:58+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 279
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "Checkout the method to Get Wishlist Data Using Customer ID in Magento 2"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to add a Custom Column to the Products Grid of Magento 2?"
    url: "https://magecomp.com/blog/add-custom-column-products-grid-magento-2/"
  - title: "How to setup a Cron Job in cPanel for Magento?"
    url: "https://magecomp.com/blog/how-to-setup-a-cron-job-in-cpanel-for-magento/"
  - title: "How to Add Dynamic Link to Footer in Magento 2?"
    url: "https://magecomp.com/blog/add-dynamic-link-footer-magento-2/"
---

# How to Get Wishlist Data Using Customer ID in Magento 2

_Published: June 23, 2023_  
_Author: Dhiren Vasoya_  

![How to Get Wishlist Data Using Customer ID in Magento 2](https://magecomp.com/blog/wp-content/uploads/2023/06/How-to-Get-Wishlist-Data-Using-Customer-ID-in-Magento-2-1024x512.webp)

**Hello Magento Friends,**

The current Magento tutorial blog illustrates How to Get Wishlist Data Using Customer ID in Magento 2.
Wishlist is a useful tool to help customers save their favorite items for future purchases. Learn [**How to Configure Wishlist in Magento 2**](https://magecomp.com/blog/configure-wishlist-in-magento-2/).
[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-4.webp)](https://magecomp.com/services/hire-magento-programmer/)

The customer’s wishlist items are linked using the customer ID. To retrieve a customer’s wishlist items, you need the customer ID to filter the wishlist collection by the corresponding customer. The customer ID serves as a unique identifier to fetch the wishlist items associated with that specific customer.
Using the below step, you can get wishlist data, including product ID and quantity of product from customer ID in Magento 2.
## Steps to Get Wishlist Data Using Customer ID in Magento 2:
**Step 1:** Create **Data.php** on the given path.
**{{magento_root}}/app/code/Vendor/Extension/Helper/Data.php**

Then add the code as follows.
```
<?php
namespace VendorExtensionHelper;
use MagentoFrameworkAppHelperContext;
use MagentoWishlistModelWishlist;

class Data extends MagentoFrameworkAppHelperAbstractHelper
{
    protected $wishlist;
    public function __construct(
        Wishlist $wishlist,
        Context $context
    ) {
        parent::__construct($context);
        $this->wishlist = $wishlist;
    }
    public function getwishlistdata($customerId)
    {
        return $this->wishlist->loadByCustomerId($customerId)->getItemCollection()->getData();
    }

}
```

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-3.webp)](https://magecomp.com/services/magento-upgrade-services/)

You can use this method in the controller file or block file as per your requirement.
## Conclusion:
Hence, using the above method, you can easily get wishlist data of customers using the customer ID in Magento 2. If you face any errors while implementing the above code, kindly share them with me through the comment section.
Share the article through social media platforms and with your other Magento friends. Stay in touch with us for more.
[![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-Malware-Removal-CTA-4.webp)](https://magecomp.com/magento-malware-removal.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/get-wishlist-data-using-customer-id-magento-2/](https://magecomp.com/blog/get-wishlist-data-using-customer-id-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-09 20:18:13 UTC_  
