Skip to content

unsubscribe(): Promise<TResponseStatus | undefined>

The unsubscribe method is asynchronous and is used to remove the product with a given stock ID from the favourites list.

Input parameters

stockId

string stockId - identifier of the product variant we want to remove from the favourites list

Returned value

A returned value has a type of Promise<TResponseStatus | undefined>. Find out more about TResponseStatus type here.

Event Bus events

This API method dispatches the following events with the Event Bus:

Example

In this example we make a AddToFavouritesApi call to remove a product with stockId 8 from the favourites list.

useStorefront(async (storefront) => {
    const favouritesApi = await storefront.getApi('AddToFavouritesApi');

    await favouritesApi.unsubscribe(8);
});

Favourites API methods reference

Objects reference