Skip to main content
Skip to main content

upsert - Sales Channel Module Reference

This documentation provides a reference to the upsert method. This belongs to the Sales Channel Module.

upsert(data, sharedContext?): Promise<SalesChannelDTO>

This method updates or creates a sales channel if it doesn't exist.

Example

const salesChannel = await salesChannelModuleService.upsert({
name: "B2B",
})

Parameters

The attributes in the sales channel to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<SalesChannelDTO>Required
The created or updated sales channel.

upsert(data, sharedContext?): Promise<SalesChannelDTO[]>

This method updates or creates sales channels if they don't exist.

Example

const salesChannels = await salesChannelModuleService.upsert([
{
name: "B2B",
},
{
id: "sc_123",
description: "Sales channel for B2B customers",
},
])

Parameters

dataUpsertSalesChannelDTO[]Required
The attributes in the sales channels to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<SalesChannelDTO[]>Required
The created or updated sales channels.
Was this section helpful?