Search.../

updateOrdersSettings( )

Developer Preview

Updates the sites' orders settings.

Description

The updateOrdersSettings() function returns a Promise that resolves to the newly updated orders settings.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateOrdersSettings(ordersSettings: OrdersSettings): Promise<UpdateOrdersSettingsResponse>

updateOrdersSettings Parameters

NAME
TYPE
DESCRIPTION
ordersSettings
OrdersSettings

Orders settings to update.

Returns

The updated orders settings.

Return Type:

Promise<
UpdateOrdersSettingsResponse
>
NAME
TYPE
DESCRIPTION
ordersSettings
OrdersSettings

The updated orders settings.

Was this helpful?

Update orders settings (dashboard page code)

Copy Code
1import { ordersSettings } from 'wix-ecom-backend';
2
3/* Sample update value:
4{
5 "ordersSettingsInfo": {
6 "createInvoice": true
7 }
8}
9*/
10
11export async function myUpdateOrdersSettingsFunction(ordersSettingsInfo) {
12 try {
13 const settings = await ordersSettings.updateOrdersSettings(ordersSettingsInfo);
14 console.log('Success! Updated orders settings:', settings);
15 return settings;
16 } catch (error) {
17 console.error(error);
18 // Handle the error
19 }
20}
21
22/*Promise resolves to:
23{
24 "ordersSettings": {
25 "inventoryUpdateTrigger": "ON_ORDER_PLACED",
26 "createInvoice": true
27 }
28}
29*/
30
Update orders settings (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { ordersSettings } from 'wix-ecom-backend';
3import { elevate } from 'wix-auth';
4
5/* Sample update value:
6 * {
7 * "ordersSettingsInfo": {
8 * "createInvoice": true
9 * }
10 * }
11 */
12
13export const myUpdateOrdersSettingsFunction = webMethod(Permissions.Admin, async (ordersSettingsInfo) => {
14 try {
15 const elevatedUpdateOrdersSettings = elevate(ordersSettings.updateOrdersSettings);
16 const settings = await elevatedUpdateOrdersSettings(ordersSettingsInfo);
17 console.log('Success! Updated orders settings:', settings);
18 return settings;
19 } catch (error) {
20 console.error(error);
21 // Handle the error
22 }
23});
24
25/*Promise resolves to:
26{
27 "ordersSettings": {
28 "inventoryUpdateTrigger": "ON_ORDER_PLACED",
29 "createInvoice": true
30 }
31}
32*/