Skip to main content
Skip to main content

upsertOptions - Product Module Reference

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

upsertOptions(data, sharedContext?): Promise<ProductOptionDTO[]>

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

Example

const options = await productModuleService.upsertOptions([
{
id: "opt_123",
title: "Color",
},
{
title: "Color",
values: ["Blue", "Green"],
product_id: "prod_123",
},
])

Parameters

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

Returns

PromisePromise<ProductOptionDTO[]>Required
The updated and created options.

upsertOptions(data, sharedContext?): Promise<ProductOptionDTO>

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

Example

const option = await productModuleService.upsertOptions({
id: "opt_123",
title: "Color",
})

Parameters

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

Returns

PromisePromise<ProductOptionDTO>Required
The updated or created option.
Was this section helpful?