Recommendations data & events
The Recommendations drop-in uses the Event Bus to emit and listen to events for communication between drop-ins and external integrations. For common events shared across multiple drop-ins (such as locale
, error
, authenticated
, etc.), see the Common Events Reference.
Emits Reference
Listens Reference
Emits and Listens Reference
Bidirectional events that both emit state changes and listen for external updates.
Event | Direction | Description |
---|---|---|
recommendations/data | Emits and Listens | Triggered when data is available or changes |
Event Details
The following sections provide detailed information about each event, including its direction, data payload structure, and usage examples.
recommendations/data (emits and listens)
Triggered when data is available or changes
Data payload
RecommendationUnitModel[] | null
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const recommendationsDataListener = events.on('recommendations/data', (data) => { console.log('recommendations/data event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningrecommendationsDataListener.off();