> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateOrdersSettings # Package: orders # Namespace: OrdersSettingsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders-settings/update-orders-settings.md ## Permission Scopes: Manage Orders: SCOPE.DC-STORES.MANAGE-ORDERS ## Introduction Updates the site's orders settings. --- ## REST API ### Schema ``` Method: updateOrdersSettings Description: Updates the site's orders settings. URL: https://www.wixapis.com/ecom/v1/orders-settings Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ordersSettings Method parameters: param name: ordersSettings | type: OrdersSettings | description: Site-level settings that control order behavior, such as when inventory is decremented and whether invoices are automatically generated. | required: true - name: inventoryUpdateTrigger | type: InventoryUpdateTrigger | description: Defines when to update the store inventory. Default: `ON_ORDER_PLACED` - enum: - ON_ORDER_PAID: Stock quantities will update only after the payment is approved. - ON_ORDER_PLACED: Stock quantities will update while the payment is being processed. If the payment did not go through, items will restock. - name: createInvoice | type: boolean | description: Whether to automatically create invoices for every new order paid online.
Default: `false`
**Note**: The issued invoice for an order is not a tax invoice and doesn't reflect refunds. You are responsible for ensuring that invoices you issue conform to any relevant legal requirements. Return type: UpdateOrdersSettingsResponse - name: ordersSettings | type: OrdersSettings | description: The updated orders settings. - name: inventoryUpdateTrigger | type: InventoryUpdateTrigger | description: Defines when to update the store inventory. Default: `ON_ORDER_PLACED` - enum: - ON_ORDER_PAID: Stock quantities will update only after the payment is approved. - ON_ORDER_PLACED: Stock quantities will update while the payment is being processed. If the payment did not go through, items will restock. - name: createInvoice | type: boolean | description: Whether to automatically create invoices for every new order paid online.
Default: `false`
**Note**: The issued invoice for an order is not a tax invoice and doesn't reflect refunds. You are responsible for ensuring that invoices you issue conform to any relevant legal requirements. - name: createdDate | type: string | description: Date and time the orders settings were created. - name: updatedDate | type: string | description: Date and time the orders settings were updated. ``` ### Examples ### Update orders settings ```curl curl -X PATCH \ 'https://www.wixapis.com/ecom/v1/orders-settings' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "ordersSettings": { "createInvoice": true } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.orders.OrdersSettingsService.updateOrdersSettings(ordersSettings) Description: Updates the site's orders settings. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ordersSettings Method parameters: param name: ordersSettings | type: OrdersSettings | description: Site-level settings that control order behavior, such as when inventory is decremented and whether invoices are automatically generated. | required: true - name: inventoryUpdateTrigger | type: InventoryUpdateTrigger | description: Defines when to update the store inventory. Default: `ON_ORDER_PLACED` - enum: - ON_ORDER_PAID: Stock quantities will update only after the payment is approved. - ON_ORDER_PLACED: Stock quantities will update while the payment is being processed. If the payment did not go through, items will restock. - name: createInvoice | type: boolean | description: Whether to automatically create invoices for every new order paid online.
Default: `false`
**Note**: The issued invoice for an order is not a tax invoice and doesn't reflect refunds. You are responsible for ensuring that invoices you issue conform to any relevant legal requirements. Return type: PROMISE - name: ordersSettings | type: OrdersSettings | description: The updated orders settings. - name: inventoryUpdateTrigger | type: InventoryUpdateTrigger | description: Defines when to update the store inventory. Default: `ON_ORDER_PLACED` - enum: - ON_ORDER_PAID: Stock quantities will update only after the payment is approved. - ON_ORDER_PLACED: Stock quantities will update while the payment is being processed. If the payment did not go through, items will restock. - name: createInvoice | type: boolean | description: Whether to automatically create invoices for every new order paid online.
Default: `false`
**Note**: The issued invoice for an order is not a tax invoice and doesn't reflect refunds. You are responsible for ensuring that invoices you issue conform to any relevant legal requirements. - name: _createdDate | type: Date | description: Date and time the orders settings were created. - name: _updatedDate | type: Date | description: Date and time the orders settings were updated. ``` ### Examples ### Update orders settings (with elevated permissions) ```javascript import { ordersSettings } from '@wix/ecom'; import { auth } from '@wix/essentials'; /* Sample update value: { "ordersSettingsInfo": { "createInvoice": true } } */ const elevatedUpdateOrdersSettings = auth.elevate(ordersSettings.updateOrdersSettings); export async function myUpdateOrdersSettingsFunction(ordersSettingsInfo) { try { const settings = await elevatedUpdateOrdersSettings(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" * } * } */ ``` ### Update orders settings ```javascript import { ordersSettings } from '@wix/ecom'; /* 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" * } * } */ ``` ### updateOrdersSettings (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { ordersSettings } from '@wix/ecom'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { ordersSettings }, // Include the auth strategy and host as relevant }); async function updateOrdersSettings(ordersSettings) { const response = await myWixClient.ordersSettings.updateOrdersSettings(ordersSettings); }; ``` ---