Skip to main content
Skip to main content

upsert - Store Module Reference

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

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

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

Example

const stores = await storeModuleService.upsert([
{
id: "store_123",
name: "Acme",
},
{
name: "Acme 2",
supported_currency_codes: ["usd"],
default_currency_code: "usd",
},
])

Parameters

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

Returns

PromisePromise<StoreDTO[]>Required
The created or updated stores.

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

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

Example

const store = await storeModuleService.upsert({
id: "store_123",
name: "Acme",
})

Parameters

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

Returns

PromisePromise<StoreDTO>Required
The created or updated store.
Was this section helpful?