This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates the sites' orders settings.
The updateOrdersSettings()
function returns a Promise that resolves to the newly updated orders settings.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateOrdersSettings(
ordersSettings: OrdersSettings,
options: UpdateOrdersSettingsOptions,
): Promise<UpdateOrdersSettingsResponse>;
Orders settings to update.
import { ordersSettings } from "wix-ecom-backend";
/* Sample update value:
{
"ordersSettingsInfo": {
"createInvoice": true
}
}
*/
export async function myUpdateOrdersSettingsFunction(ordersSettingsInfo) {
try {
const settings =
await ordersSettings.updateOrdersSettings(ordersSettingsInfo);
console.log("Success! Updated orders settings:", settings);
return settings;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "ordersSettings": {
* "inventoryUpdateTrigger": "ON_ORDER_PLACED",
* "createInvoice": true,
* "createdDate": "2024-07-04T15:10:46.070Z",
* "updatedDate": "2024-07-04T15:10:46.070Z"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.