> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.shopify.draftorders.UpdateDraftOrder

- Component: `appmixer.shopify.draftorders.UpdateDraftOrder`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.shopify 4.1.0](https://connectors.appmixer.com/connector/appmixer.shopify/4.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.shopify/4.1.0/component/appmixer.shopify.draftorders.UpdateDraftOrder>

Update a draft order that is not completed yet. Fields left empty are not changed; line items, when given, replace all line items. Needs the write_draft_orders access scope on the Shopify app.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Draft Order ID (`id`) | text | The ID of the draft order: the global ID (gid://shopify/DraftOrder/123) or the numeric ID from the draft order's admin URL. |
| Line Items (`lineItems`) | expression | Replaces all line items of the draft order. Leave empty to keep them. The products of the draft order. Each item is either a product variant of your store, or a custom item with its own title and price. |
| Customer (`customerId`) | text | Pick the customer, or enter the customer ID (global or numeric). |
| Email (`email`) | text | The customer's email address for the draft order. |
| Phone (`phone`) | text | The customer's phone number, in E.164 format (for example +15145556789). |
| Note (`note`) | textarea | A note for the draft order. Replaces the current note. |
| Tags (`tags`) | text | Comma-separated tags. Replaces all tags of the draft order. |
| PO Number (`poNumber`) | text | The purchase order number. |
| Tax Exempt (`taxExempt`) | toggle | Whether the draft order is exempt from taxes. |
| First Name (`shippingFirstName`) | text | - |
| Last Name (`shippingLastName`) | text | - |
| Company (`shippingCompany`) | text | - |
| Address Line 1 (`shippingAddress1`) | text | - |
| Address Line 2 (`shippingAddress2`) | text | - |
| City (`shippingCity`) | text | - |
| Province Code (`shippingProvinceCode`) | text | State or province code, for example `ON` or `CA`. Names are not accepted. |
| Country Code (`shippingCountryCode`) | text | Two-letter ISO country code, for example `CZ` or `US`. Names are not accepted. |
| Postal Code (`shippingZip`) | text | - |
| Phone (`shippingPhone`) | text | - |

## Output ports

### Port `out`

_No fields defined for this port._

## Full metadata (component.json)

```json
{
  "name": "appmixer.shopify.draftorders.UpdateDraftOrder",
  "description": "Update a draft order that is not completed yet. Fields left empty are not changed; line items, when given, replace all line items. Needs the write_draft_orders access scope on the Shopify app.",
  "author": "Appmixer <info@appmixer.com>",
  "private": false,
  "auth": {
    "service": "appmixer:shopify",
    "scope": [
      "read_draft_orders",
      "write_orders"
    ]
  },
  "quota": {
    "manager": "appmixer:shopify",
    "resources": "requests",
    "scope": {
      "userId": "{{userId}}"
    }
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lineItems": {
            "type": "object"
          },
          "customerId": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "tags": {
            "type": "string"
          },
          "poNumber": {
            "type": "string"
          },
          "taxExempt": {
            "type": "boolean"
          },
          "shippingFirstName": {
            "type": "string"
          },
          "shippingLastName": {
            "type": "string"
          },
          "shippingCompany": {
            "type": "string"
          },
          "shippingAddress1": {
            "type": "string"
          },
          "shippingAddress2": {
            "type": "string"
          },
          "shippingCity": {
            "type": "string"
          },
          "shippingProvinceCode": {
            "type": "string"
          },
          "shippingCountryCode": {
            "type": "string"
          },
          "shippingZip": {
            "type": "string"
          },
          "shippingPhone": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "inspector": {
        "inputs": {
          "id": {
            "type": "text",
            "label": "Draft Order ID",
            "index": 1,
            "tooltip": "The ID of the draft order: the global ID (gid://shopify/DraftOrder/123) or the numeric ID from the draft order's admin URL."
          },
          "lineItems": {
            "type": "expression",
            "label": "Line Items",
            "index": 2,
            "levels": [
              "ADD"
            ],
            "tooltip": "Replaces all line items of the draft order. Leave empty to keep them. The products of the draft order. Each item is either a product variant of your store, or a custom item with its own title and price.",
            "fields": {
              "itemType": {
                "type": "select",
                "label": "Item Type",
                "index": 1,
                "defaultValue": "variant",
                "options": [
                  {
                    "value": "variant",
                    "label": "Product variant"
                  },
                  {
                    "value": "custom",
                    "label": "Custom item"
                  }
                ]
              },
              "variantId": {
                "type": "text",
                "label": "Product Variant",
                "index": 2,
                "tooltip": "Pick a product variant, or enter its ID (global or numeric). Its title and price are taken from the product.",
                "source": {
                  "url": "/component/appmixer/shopify/products/FindProducts?outPort=out",
                  "data": {
                    "messages": {
                      "in/outputType": "array"
                    },
                    "properties": {
                      "isSource": true
                    },
                    "transform": "./FindProducts#variantsToSelectArray"
                  }
                },
                "when": {
                  "eq": {
                    "./itemType": "variant"
                  }
                }
              },
              "title": {
                "type": "text",
                "label": "Title",
                "index": 3,
                "tooltip": "The title of the custom item.",
                "when": {
                  "eq": {
                    "./itemType": "custom"
                  }
                }
              },
              "price": {
                "type": "number",
                "label": "Unit Price",
                "index": 4,
                "tooltip": "The price of one custom item, in the store currency.",
                "when": {
                  "eq": {
                    "./itemType": "custom"
                  }
                }
              },
              "sku": {
                "type": "text",
                "label": "SKU",
                "index": 5,
                "when": {
                  "eq": {
                    "./itemType": "custom"
                  }
                }
              },
              "quantity": {
                "type": "number",
                "label": "Quantity",
                "index": 6,
                "defaultValue": 1,
                "tooltip": "How many units are ordered."
              },
              "taxable": {
                "type": "toggle",
                "label": "Taxable",
                "index": 7,
                "defaultValue": true,
                "when": {
                  "eq": {
                    "./itemType": "custom"
                  }
                }
              },
              "requiresShipping": {
                "type": "toggle",
                "label": "Requires Shipping",
                "index": 8,
                "defaultValue": true,
                "when": {
                  "eq": {
                    "./itemType": "custom"
                  }
                }
              }
            }
          },
          "customerId": {
            "type": "text",
            "label": "Customer",
            "tooltip": "Pick the customer, or enter the customer ID (global or numeric).",
            "source": {
              "url": "/component/appmixer/shopify/customers/FindCustomers?outPort=out",
              "data": {
                "messages": {
                  "in/outputType": "array"
                },
                "properties": {
                  "isSource": true
                },
                "transform": "./FindCustomers#customersToSelectArray"
              }
            },
            "index": 3
          },
          "email": {
            "type": "text",
            "label": "Email",
            "tooltip": "The customer's email address for the draft order.",
            "index": 4
          },
          "phone": {
            "type": "text",
            "label": "Phone",
            "tooltip": "The customer's phone number, in E.164 format (for example +15145556789).",
            "index": 5
          },
          "note": {
            "type": "textarea",
            "label": "Note",
            "tooltip": "A note for the draft order. Replaces the current note.",
            "index": 6
          },
          "tags": {
            "type": "text",
            "label": "Tags",
            "tooltip": "Comma-separated tags. Replaces all tags of the draft order.",
            "index": 7
          },
          "poNumber": {
            "type": "text",
            "label": "PO Number",
            "tooltip": "The purchase order number.",
            "index": 8
          },
          "taxExempt": {
            "type": "toggle",
            "label": "Tax Exempt",
            "tooltip": "Whether the draft order is exempt from taxes.",
            "index": 9
          },
          "shippingFirstName": {
            "type": "text",
            "label": "First Name",
            "index": 20,
            "group": "shippingAddress"
          },
          "shippingLastName": {
            "type": "text",
            "label": "Last Name",
            "index": 21,
            "group": "shippingAddress"
          },
          "shippingCompany": {
            "type": "text",
            "label": "Company",
            "index": 22,
            "group": "shippingAddress"
          },
          "shippingAddress1": {
            "type": "text",
            "label": "Address Line 1",
            "index": 23,
            "group": "shippingAddress"
          },
          "shippingAddress2": {
            "type": "text",
            "label": "Address Line 2",
            "index": 24,
            "group": "shippingAddress"
          },
          "shippingCity": {
            "type": "text",
            "label": "City",
            "index": 25,
            "group": "shippingAddress"
          },
          "shippingProvinceCode": {
            "type": "text",
            "label": "Province Code",
            "index": 26,
            "group": "shippingAddress",
            "tooltip": "State or province code, for example <code>ON</code> or <code>CA</code>. Names are not accepted."
          },
          "shippingCountryCode": {
            "type": "text",
            "label": "Country Code",
            "index": 27,
            "group": "shippingAddress",
            "tooltip": "Two-letter ISO country code, for example <code>CZ</code> or <code>US</code>. Names are not accepted."
          },
          "shippingZip": {
            "type": "text",
            "label": "Postal Code",
            "index": 28,
            "group": "shippingAddress"
          },
          "shippingPhone": {
            "type": "text",
            "label": "Phone",
            "index": 29,
            "group": "shippingAddress"
          }
        },
        "groups": {
          "shippingAddress": {
            "label": "Shipping Address",
            "index": 1
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out"
    }
  ],
  "icon": "(data URI omitted)"
}
```
