> 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 # DeleteDraftOrder # Package: orders # Namespace: DraftOrders # Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/draft-orders/delete-draft-order.md ## Permission Scopes: Manage eCommerce - all permissions: SCOPE.DC-ECOM-MEGA.MANAGE-ECOM ## Introduction Deletes a draft order along with all its pending changes. Draft orders with status 'COMMITTED' cannot be deleted. --- ## REST API ### Schema ``` Method: deleteDraftOrder Description: Deletes a draft order along with all its pending changes. Draft orders with status 'COMMITTED' cannot be deleted. URL: https://www.wixapis.com/ecom/v1/draft-orders/{draftOrderId} Method: DELETE # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: draftOrderId Method parameters: param name: draftOrderId | type: none | required: true Return type: DeleteDraftOrderResponse EMPTY-OBJECT {} Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: DRAFT_ORDER_DOES_NOT_EXIST | Description: Couldn't find the draft order. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: DRAFT_ORDER_CANNOT_BE_DELETED | Description: Can't delete draft order due to ownership or status validation. ``` ### Examples ### Delete Draft Order Delete a draft order by ID. ```curl curl -X DELETE \ 'https://www.wixapis.com/ecom/v1/draft-orders/9ef5d33e-9545-4e91-b5d3-3e9545ae91d0' \ -H 'Authorization: ' \ -H 'Content-type: application/json' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.orders.DraftOrders.deleteDraftOrder(draftOrderId) Description: Deletes a draft order along with all its pending changes. Draft orders with status 'COMMITTED' cannot be deleted. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: draftOrderId Method parameters: param name: draftOrderId | type: string | description: Draft order GUID. | required: true Return type: PROMISE EMPTY-OBJECT {} Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: DRAFT_ORDER_DOES_NOT_EXIST | Description: Couldn't find the draft order. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: DRAFT_ORDER_CANNOT_BE_DELETED | Description: Can't delete draft order due to ownership or status validation. ``` ### Examples ### deleteDraftOrder ```javascript import { draftOrders } from '@wix/ecom'; async function deleteDraftOrder(draftOrderId) { const response = await draftOrders.deleteDraftOrder(draftOrderId); }; ``` ### deleteDraftOrder (with elevated permissions) ```javascript import { draftOrders } from '@wix/ecom'; import { auth } from '@wix/essentials'; async function myDeleteDraftOrderMethod(draftOrderId) { const elevatedDeleteDraftOrder = auth.elevate(draftOrders.deleteDraftOrder); const response = await elevatedDeleteDraftOrder(draftOrderId); } ``` ### deleteDraftOrder (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 { draftOrders } from '@wix/ecom'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { draftOrders }, // Include the auth strategy and host as relevant }); async function deleteDraftOrder(draftOrderId) { const response = await myWixClient.draftOrders.deleteDraftOrder(draftOrderId); }; ``` ---