Events reference
Events are callbacks the plugin fires when something happens. Register them on the pulpoar object:
pulpoar.onAddToCart((variants) => {
// ...
});
The Templates column shows which Theme Designer templates fire the event. "All" means every template.
Core events
| Event | Payload | Description | Templates |
|---|---|---|---|
onReady | Project data | The plugin is ready. The payload includes your catalog data. | All |
onError | Error | Something went wrong. | All |
onPathChange | { referer: string; path: string } | The current screen changed. | All |
onTryNowClick | { fallback: string } | The camera was started from the camera permission step. fallback is the path it opens. | All |
onGdprApprove | { approved: boolean } | The GDPR checkbox was clicked. | All |
onGdprLinkClick | { url: string; text: string } | A link in the GDPR text was clicked (when "convert links to events" is on). | Basic, Advanced |
Camera and photo events
| Event | Payload | Description | Templates |
|---|---|---|---|
onUploadPhoto | undefined | The user uploaded a photo from the device. | All |
onModelSelect | { image: string; id: number } | A model was selected. | All |
onTakePhoto | undefined | A photo was taken. | All |
onUsePhoto | undefined | Use Photo was clicked after taking a photo. | All |
onTakePhotoAgain | undefined | Take Again was clicked after taking a photo. | All |
onCameraMirror | { active: boolean } | The camera mirror setting changed. | Basic, Simple, Advanced |
onCameraSwitch | { facingMode: 'user' | 'environment' } | The user switched between front and back camera. | Basic, Simple |
Catalog events
| Event | Payload | Description | Templates |
|---|---|---|---|
onExperienceSelect | { type: 'look' | 'product' | 'live-camera' | 'take-photo' | 'upload-photo' | 'choose-model' } | An experience was selected. | All |
onLookSelect | Look | A look was selected. | All |
onBrandSelect | Brand | A brand was selected. | All |
onCategorySelect | Category | A category was selected. | All |
onProductSelect | Product | A product was selected. | All |
onVariantSelect | Variant | A variant was selected. | All |
onAppliedVariantsChange | { variantIds: string[]; triggererVariantIds: string[] } | The applied variants changed. This includes clearing them when the catalog is on. | All |
onTryOn | { variantIds: string[] } | A product was actually applied and rendered. It never fires when makeup is cleared. | All |
onAddToCart | Variant[] | An Add to Cart button was clicked. | All |
onGoToProduct | Variant (includes product info) | A variant link was clicked. | All |
onGoBack | undefined | The catalog's Go Back control was used. | All |
onContinue | { slug: string; variant: Variant } | Continue was clicked on the try-on, with the shade on screen. Doesn't fire if no shade is selected. | Popup |
UI events
| Event | Payload | Description | Templates |
|---|---|---|---|
onCurtainToggle | { active: boolean } | The before/after curtain was toggled. | All |
onCurtainSlideStart | { posX: number } | The user started dragging the before/after slider. | All |
onCurtainSlideEnd | { posX: number } | The user stopped dragging the before/after slider. | All |
onOpacitySlideStart | { percentage: number } | The user started dragging the opacity slider. | Basic, Simple, Advanced |
onOpacitySlideEnd | { percentage: number } | The user stopped dragging the opacity slider. | Basic, Simple, Advanced |
onZoom | { type: 'in' | 'out'; value: number } | The zoom level changed. | Basic, Simple, Advanced |
Common recipes
Connect Add to Cart to your cart
pulpoar.onAddToCart((variants) => {
variants.forEach((variant) => {
addToCart(variant.id, variant.name, variant.price);
});
});
Route to the product page in a mobile app
In a WebView the plugin can't open links inside your app. Handle onGoToProduct and navigate yourself:
pulpoar.onGoToProduct((variant) => {
// variant includes product info
openProductScreen(variant);
});
Track what users try on
pulpoar.onTryOn(({ variantIds }) => {
analytics.track('vto_try_on', { variantIds });
});