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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?