How to Add Products to Wishlist By GraphQL Mutation Magento 2?

addProductsToWishlist mutation to add any type of products in the wishlist using GraphQL Mutation Magento 2.

Before adding with mutation, Make sure the Wishlist feature is activated by settings.
Go to Admin panel, Click Left sidebar Stores -> Configuration.
Now Click on Customers Tab -> Wish List -> General Options -> Enable -> Yes. Continue reading “How to Add Products to Wishlist By GraphQL Mutation Magento 2?”

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. Continue reading “How to get Wishlist GraphQL Query Magento 2?”

How to use of wishlist_add_product event in Magento 2?

Wishlist adds product events that will be used to define data after a successful item added to the wishlist.

If you want to trigger something once product added to wishlist or do some action after item added to the wishlist, you need to define "wishlist_add_product" in your events.xml file.

Create Observer Class to handle your logic after adding items to the wishlist. In the observer file, You got Product, Wishlist, and Current Item object, based on that you can retrieve/modify your logic. Continue reading “How to use of wishlist_add_product event in Magento 2?”