How to get Wishlist GraphQL Query Magento 2?

Magento Wishlist supports the GraphQL query feature. You can refer to the module-wishlist-graph-ql from the Magento core code to get more info on the specific query feature.

The schema.graphql file for the Wishlist module will be available at the path, vendor/magento/module-wishlist-graph-ql/etc/schema.graphqls

You must have enabled the Wishlist feature to get the output of the query by Stores -> Configuration -> Customers -> Wish List -> General Options -> Enable -> Yes.

If you have a disabled wishlist from the configuration and try to execute a wishlist query, it will throw an Error message, The wishlist configuration is currently disabled.

If wishlist settings enable and want to try to execute a query, you will get an expected output,

Syntax:


Steps to Execute Wishlist Query by GraphQL Altair App,

  1. Generate Customer Tokenand set it with Bearer value,
    Authorization Bearer {CUSTOMER_TOKEN}
  2. Wishlist GraphQL Query,

A Wishlist is the part of Customer Query from Magento 2.4.

Earlier you can use query wishlist {} but The wishlist query has been deprecated from the 2.4 Version.

Always use the best standard with taking parent as customer{} query and define your wishlist inside it.

As per the above query, we have to use the latest query feature without the deprecated method.

Output:
I have added one simple and one configurable item to the wishlist,

You can use only the required field in your output to improve performance instead of getting all the fields in the payload.

If you want to explore the product full details, use the  ... on ConfigurableProduct {} for the configurable item, ... on BundleProduct {} for the bundle item and ... on DownloadableProduct {} for the downloadable item.