Run custom code when a product is added to wish list

Would you like customers to save products in a wish list so they can review them later? How about sharing a wish list with friends and family to encourage gift giving? Sitefinity CMS Ecommerce has a wish list feature that is especially useful for customers who spend a lot of time comparing, researching and reading about products prior to purchase or just aren't quite ready to make that purchase. Merchants offering wish lists not only increase return visits, but also sale conversions at a later time simply by having this feature available for shoppers.

To add a product to your wish list, customers must register with the online store or log in. New wish list registrations default to private, but can be made public and then shared via social sharing sites. They can also be emailed to a friend. Once registered, customers can return to the store at any time to see their wish list.

For Merchants
Enabling the wish list gives your shoppers more flexibility and makes customers more likely to return to purchase additional items.  Also, by promoting social sharing, your site will get additional exposure thereby increasing visitors and possible conversions.  Wish list widget

For Developers
You can subscribe to OnProductInWishlistPurchased and OnProductAddedToWishList events and run your own custom logic if desired (like sending emails etc). For developers: Wish lists

Here's an example:

Add Global.asax file and add this code in the cs file:

To hook up to these events, you must perform the following:

  • Handle the Initialized event of the Bootstrapper.
    For more information, read Ecommerce events.
  • Subscribe to the events.
    In the handler for the Initialized event of the Bootstrapper, subscribe to the event using the Subscribe static method of EventHub class. As generic argument pass ProductAddedToWishListEvent and ProductInWishlistPurchasedEvent, and as the handler argument pass the method to handle the event.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?