Skip to main content
Skip to main content

create - Product Module Reference

Beta

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

This method is used to create a product.

Example

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

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

const products = await productModule.create([
{
title
}
])

// do something with the products or return them
}

Parameters

dataCreateProductDTO[]Required
The products to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductDTO[]>Required
The list of created products.
Was this section helpful?