Skip to main content
Skip to main content

createCollections - Product Module Reference

Beta

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

This method is used to create product collections.

Example

import {
initialize as initializeProductModule,
} from "@medusajs/product"

async function createCollection (title: string) {
const productModule = await initializeProductModule()

const collections = await productModule.createCollections([
{
title
}
])

// do something with the product collections or return them
}

Parameters

The product collections to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductCollectionDTO[]>Required
The list of created product collections.
Was this section helpful?