Skip to main content
Skip to main content

createTypes - Product Module Reference

Beta

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

This method is used to create a product type.

Example

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

async function createProductType (value: string) {
const productModule = await initializeProductModule()

const productTypes = await productModule.createTypes([
{
value
}
])

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

Parameters

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

Returns

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