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';23/* Sample update value:4{5 "ordersSettingsInfo": {6 "createInvoice": true7 }8}9*/1011export 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 error19 }20}2122/*Promise resolves to:23{24 "ordersSettings": {25 "inventoryUpdateTrigger": "ON_ORDER_PLACED",26 "createInvoice": true27 }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';45/* Sample update value:6 * {7 * "ordersSettingsInfo": {8 * "createInvoice": true9 * }10 * }11 */1213export 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 error22 }23});2425/*Promise resolves to:26{27 "ordersSettings": {28 "inventoryUpdateTrigger": "ON_ORDER_PLACED",29 "createInvoice": true30 }31}32*/