> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetOrderDraftabilityStatus

# Package: orders

# Namespace: DraftOrders

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/draft-orders/get-order-draftability-status.md

## Permission Scopes:
Edit an order: SCOPE.ECOM.DRAFT-ORDERS

## Introduction

Checks whether a draft can be created for an order.

If `orderDraftable` returns as `true`, the order can be used to create a draft order.

If `orderDraftable` returns as `false`, refer to the `nonDraftableReasons` array in the response to understand why the order is not draftable.

---

## REST API

### Schema

```
 Method: getOrderDraftabilityStatus
 Description: Checks whether a draft can be created for an order.  If `orderDraftable` returns as `true`, the order can be used to create a draft order.  If `orderDraftable` returns as `false`, refer to the `nonDraftableReasons` array in the response to understand why the order is not draftable.
 URL: https://www.wixapis.com/ecom/v1/draft-orders/{orderId}/draftability
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  orderId
 Method parameters: 
   param name: orderId | type:   none | required: true 
 Return type: GetOrderDraftabilityStatusResponse
  - name: orderId | type: string | description: Order GUID.  | validation: format GUID
  - name: orderDraftable | type: boolean | description: Whether a draft can be created based on the order.  
  - name: nonDraftableReasons | type: array<NonDraftableReason> | description: Reasons why a draft order cannot be created from the order.  | validation: minItems 0, maxItems 5
     - enum:
     -     PARTIALLY_OR_FULLY_REFUNDED: Modifications of refunded orders are not supported.
     -     UNSUPPORTED_CHANNEL_TYPE: Original order must be created via one of the following channel types: + WEB + POS + BACKOFFICE_MERCHANT + WIX_APP_STORE
     -     ORDER_STATUS_IS_NOT_SUPPORTED: Order status is not APPROVED.
     -     ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT: Site and order currencies are different.
     -     ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT: Site and order weight units are different.
     -     ORDER_NOT_FOUND: Order not found.
     -     SUBSCRIPTION_LINE_ITEM_EXISTS: Modifications of orders with subscription items are not supported.

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code:  | Description: Couldn't find the order.


```

### Examples

### Get Order Draftability Status
Example of non-draftable order.

```curl
curl -X GET \
    'https://www.wixapis.com/ecom/v1/draft-orders/1f187cab-27b0-48ba-854d-ad882edbc21f/draftability' \
    -H 'Authorization:  <AUTH>' \
    -H 'Content-type: application/json'
```

### Get Order Draftability Status
Checks whether a draft can be created for an order.

```curl
curl -X GET \
    'https://www.wixapis.com/ecom/v1/draft-orders/15d18c8e-44cd-4790-85a6-c0ebc1dc5ace/draftability' \
    -H 'Authorization:  <AUTH>' \
    -H 'Content-type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.draftOrders.getOrderDraftabilityStatus(orderId)
 Description: Checks whether a draft can be created for an order.  If `orderDraftable` returns as `true`, the order can be used to create a draft order.  If `orderDraftable` returns as `false`, refer to the `nonDraftableReasons` array in the response to understand why the order is not draftable.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  orderId
 Method parameters: 
   param name: orderId | type: string | description: Order GUID. | required: true | validation: format GUID
 Return type: PROMISE<GetOrderDraftabilityStatusResponse>
  - name: orderId | type: string | description: Order GUID.  | validation: format GUID
  - name: orderDraftable | type: boolean | description: Whether a draft can be created based on the order.  
  - name: nonDraftableReasons | type: array<NonDraftableReason> | description: Reasons why a draft order cannot be created from the order.  | validation: minItems 0, maxItems 5
     - enum:
     -     PARTIALLY_OR_FULLY_REFUNDED: Modifications of refunded orders are not supported.
     -     UNSUPPORTED_CHANNEL_TYPE: Original order must be created via one of the following channel types: + WEB + POS + BACKOFFICE_MERCHANT + WIX_APP_STORE
     -     ORDER_STATUS_IS_NOT_SUPPORTED: Order status is not APPROVED.
     -     ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT: Site and order currencies are different.
     -     ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT: Site and order weight units are different.
     -     ORDER_NOT_FOUND: Order not found.
     -     SUBSCRIPTION_LINE_ITEM_EXISTS: Modifications of orders with subscription items are not supported.

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code:  | Description: Couldn't find the order.


```

### Examples

### Get Order Draftability Status
Checks whether a draft order can be created for an order.

```javascript
import { draftOrders } from "@wix/ecom";

const orderId = "ebad089a-c13a-4532-866d-2be7ce3ab7c8";

async function getOrderDraftabilityStatus() {
  const response = await draftOrders.getOrderDraftabilityStatus(orderId);
}

/* Promise resolves to:
 * {
 *   "orderId": "ebad089a-c13a-4532-866d-2be7ce3ab7c8",
 *   "orderDraftable": true,
 *   "nonDraftableReasons": []
 * }
 */

```

### getOrderDraftabilityStatus (self-managed)
Self-managed 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 getOrderDraftabilityStatus(orderId) {
  const response = await myWixClient.draftOrders.getOrderDraftabilityStatus(orderId);
};
```

---