Search.../

onCollectionCreated( )

An event that fires when a product collection is created.

Description

The onCollectionCreated() event handler runs when a product collection is added to a store.

Note: Backend events don't work when previewing your site.

Syntax

function onCollectionCreated(event: CollectionCreatedEvent): void

onCollectionCreated Parameters

NAME
TYPE
DESCRIPTION
event
CollectionCreatedEvent

Information about the product collection that was created.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when a product collection is created

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3
4export function wixStores_onCollectionCreated(event) {
5 let collectionId = event._id;
6}
7
8/* Full event object:
9 *
10 * {
11 * "name": "New Collection",
12 * "_id": "a7698dfb-12e8-1bd6-cdc1-0116554f18d1",
13 * "mainMedia": "wix:image://v1/c...8.jpg/file.jpg#originWidth=2700&originHeight=2186"
14 * }
15 *
16 */