createCategory - Product Module Reference
BetaThis documentation provides a reference to the createCategory method. This belongs to the Product Module.
This method is used to create a product category.
Example
import {
initialize as initializeProductModule,
} from "@medusajs/product"
async function createCategory (name: string, parent_category_id: string | null) {
const productModule = await initializeProductModule()
const category = await productModule.createCategory({
name,
parent_category_id
})
// do something with the product category or return it
}
Parameters
The product category to be created.
Returns
The created product category.
Was this section helpful?