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.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?