Skip to main content
Skip to main content

upsertCollections - Product Module Reference

This documentation provides a reference to the upsertCollections method. This belongs to the Product Module.

upsertCollections(data, sharedContext?): Promise<ProductCollectionDTO[]>

This method updates existing collections, or creates new ones if they don't exist.

Example

const collections =
await productModuleService.upsertCollections([
{
id: "pcol_123",
title: "Winter Collection",
},
{
title: "Summer Collection",
},
])

Parameters

The attributes to update or create for each collection.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductCollectionDTO[]>Required
The updated and created collections.

upsertCollections(data, sharedContext?): Promise<ProductCollectionDTO>

This method updates an existing collection, or creates a new one if it doesn't exist.

Example

const collection =
await productModuleService.upsertCollections({
id: "pcol_123",
title: "Winter Collection",
})

Parameters

The attributes to update or create for the collection.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductCollectionDTO>Required
The updated or created collection.
Was this section helpful?