Wishlist Notifications

Wishlist Notifications

Wishlist Notifications

Trigger notifications for certain Wishlist events.

This guides explains how to trigger notifications for certain Wishlist events. You can for example trigger a popup when a product has been added to the Wishlist. In an effort to keep Wishlist King as light as possible, we have not added a Popup or Toast library. This needs to be added on your end.

Requires coding This customisation requires some light coding. If you are unfamiliar with code, please get in touch for help.

Code Access

Notifications can be triggered with Event Subscribers in Code Access. Make sure that the Code Access app embed is enabled in the theme editor, otherwise the code will not load into your theme.

In Code Access navigate to Save for Later in the left hand column. Here you will find some default event subscribers. We recommend to leave these as they are.

Subscribe to Wishlist Event

Every customer interaction with the Wishlist will trigger an event. In this example we will subscribe to the event wk:wishlist:add:success which is triggered after a product was added the to the Wishlist.

The event data will differ depending on the event type. In this example we log the product title to the browser console. Use this as a starting point to implement your own customisations.

export function setup({ app }) {
  // Add this below the other subscribers
  app.events.subscribe("wk:wishlist:add:success", (event) => {
    console.log(`${event.data.product.title} added to Wishlist`);
  });
}
Event Subscribers

Wishlist Events

Here is a list of all the events that can be subscribed to.

  • wk:wishlist:add:success
  • wk:wishlist:add:error
  • wk:wishlist:remove:success
  • wk:wishlist:remove:error
  • wk:wishlist:change-variant:success
  • wk:wishlist:change-variant:error
  • wk:wishlist:clear:success
  • wk:wishlist:clear:error
  • wk:wishlist:share:success
  • wk:wishlist:share:error
  • wk:wishlist:add-to-cart:success
  • wk:wishlist:add-to-cart:error
  • wk:wishlist:add-all-to-cart:success
  • wk:wishlist:add-all-to-cart:error
  • wk:wishlist:page-view
  • wk:wishlist:login-required
  • wk:customer:login
  • wk:customer:logout