Skip to content

Wishlist Data & Events

The Wishlist drop-in uses the event bus to emit and listen to events for communication between drop-ins and external integrations.

EventDirectionDescription
wishlist/initializedEmitsEmitted when the component completes initialization.
wishlist/alertEmits and listensEmitted when the wishlist shows an alert or notification.
wishlist/allItemsEmitsEmitted when the full list of all wishlist items is available or changes.
wishlist/dataEmits and listensTriggered when data is available or changes.
wishlist/resetEmits and listensTriggered when the component state is reset.

The following sections provide detailed information about each event, including its direction, event payload, and usage examples.

Emitted when the wishlist shows an alert or notification.

WishlistActionPayload | null

See WishlistActionPayload for full type definition.

import { events } from '/@dropins/tools/event-bus.js';
events.on('wishlist/alert', (payload) => {
console.log('wishlist/alert event received:', payload);
// Add your custom logic here
});

Emitted when the full list of all wishlist items across all pages is available or changes. This event provides the complete item list, unlike wishlist/data which contains the current page of items.

Item[]
import { events } from '/@dropins/tools/event-bus.js';
events.on('wishlist/allItems', (items) => {
console.log('wishlist/allItems event received:', items);
// Add your custom logic here
});

Emitted when wishlist data is updated or retrieved. This event is triggered after operations like adding items, removing items, or updating quantities in the wishlist.

Wishlist | null

See Wishlist for full type definition.

By default, wishlist/data carries the shopper’s active wishlist, and every listener shares that one channel. When you render an additional wishlist (such as a “Save for Later” list) alongside the active one, pass a scope so its data travels on its own channel and does not overwrite the active list. A container rendered with the same scope listens only to that channel.

import { events } from '/@dropins/tools/event-bus.js';
// Listen only to the 'save-for-later' channel
events.on('wishlist/data', (payload) => {
console.log('save-for-later data:', payload);
}, { scope: 'save-for-later' });

The drop-in functions that load or mutate a wishlist accept { scope } and emit on that channel. See Render an additional wishlist for the full pattern.

import { events } from '/@dropins/tools/event-bus.js';
events.on('wishlist/data', (payload) => {
console.log('wishlist/data event received:', payload);
// Add your custom logic here
});

Emitted when the wishlist component completes initialization. This indicates the wishlist is ready to display items and accept user interactions.

Wishlist | null

See Wishlist for full type definition.

import { events } from '/@dropins/tools/event-bus.js';
events.on('wishlist/initialized', (payload) => {
console.log('wishlist/initialized event received:', payload);
// Add your custom logic here
});

Triggered when the component state is reset.

undefined

This event does not include a payload.

import { events } from '/@dropins/tools/event-bus.js';
events.on('wishlist/reset', (payload) => {
console.log('wishlist/reset event received:', payload);
// Add your custom logic here
});

The following data models are used in event payloads for this drop-in.

Used in: wishlist/data, wishlist/initialized.

interface Wishlist {
id: string;
name?: string;
updated_at: string;
sharing_code: string;
items_count: number;
items: Item[];
}

Used in: wishlist/alert.

interface WishlistActionPayload {
action: WishlistAlertProps.action;
item: WishlistAlertProps.item;
}