> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/mutations/updatepickingorder.md).

# Update Picking Order

updatePickingOrder Mutation

Updates an existing picking order with new data. This allows modification of picking order details and management of associated order items.

## Arguments

| Name    | Type                       | Description                                |
| ------- | -------------------------- | ------------------------------------------ |
| `id`    | `ID!`                      | Required ID of the picking order to update |
| `input` | `UpdatePickingOrderInput!` | Input data for updating the picking order  |

## Return Type

`PickingOrderOutput` - Contains the updated picking order and any associated workflows.

## Input Fields

`UpdatePickingOrderInput`:

| Field                | Type      | Description                                         |
| -------------------- | --------- | --------------------------------------------------- |
| `dataTypeID`         | `UUID`    | Optional data type ID for custom validation         |
| `clearDataTypeID`    | `Boolean` | Clear the current data type ID                      |
| `dataTypeSlug`       | `String`  | Optional data type slug for custom validation       |
| `clearDataTypeSlug`  | `Boolean` | Clear the current data type slug                    |
| `data`               | `Map`     | Custom data associated with the picking order       |
| `clearData`          | `Boolean` | Clear all custom data                               |
| `customerID`         | `UUID`    | ID of the customer this order is for                |
| `addOrderItemIDs`    | `[ID!]`   | List of order item IDs to associate with this order |
| `removeOrderItemIDs` | `[ID!]`   | List of order item IDs to remove from this order    |
| `clearOrderItems`    | `Boolean` | Remove all order items from this order              |

## Usage Example

```graphql
mutation {
  updatePickingOrder(
    id: "550e8400-e29b-41d4-a716-446655440000",
    input: {
      data: {
        "order_number": "PO-12345-UPDATED",
        "priority": "urgent",
        "delivery_address": {
          "street": "456 Updated St",
          "city": "New Springfield",
          "postalCode": "67890",
          "country": "US"
        },
        "notes": "Rush order - handle with care"
      },
      customerID: "123e4567-e89b-12d3-a456-426614174000"
    }
  ) {
    pickingOrder {
      id
      customerID
      data
      updatedAt
      orderitems {
        id
        sku
        quantity
      }
    }
    workflows {
      id
      type
      id
      runID
      status
    }
  }
}
```

## JavaScript Example

```javascript
const updatePickingOrderMutation = `
  mutation UpdatePickingOrder($id: ID!, $input: UpdatePickingOrderInput!) {
    updatePickingOrder(id: $id, input: $input) {
      pickingOrder {
        id
        customerID
        data
        updatedAt
        orderitems {
          id
          sku
          quantity
        }
      }
      workflows {
        id
        type
        id
        runID
        status
      }
    }
  }
`;

const variables = {
  id: "550e8400-e29b-41d4-a716-446655440000",
  input: {
    data: {
      order_number: "PO-12345-UPDATED",
      priority: "urgent",
      delivery_address: {
        street: "456 Updated St",
        city: "New Springfield",
        postalCode: "67890",
        country: "US"
      },
      notes: "Rush order - handle with care"
    },
    customerID: "123e4567-e89b-12d3-a456-426614174000"
  }
};

// Using fetch or your preferred GraphQL client
const response = await fetch('/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    query: updatePickingOrderMutation,
    variables: variables
  })
});

const result = await response.json();
console.log('Updated picking order:', result.data.updatePickingOrder);
```

## Managing Order Items

You can also use this mutation to manage the relationships between the picking order and its items:

```graphql
mutation {
  updatePickingOrder(
    id: "550e8400-e29b-41d4-a716-446655440000",
    input: {
      addOrderItemIDs: ["item-1", "item-2"],
      removeOrderItemIDs: ["item-3"]
    }
  ) {
    pickingOrder {
      id
      orderitems {
        id
        sku
        quantity
      }
    }
  }
}
```

## Notes

* The picking order must exist and be accessible to the current user
* Updates may trigger associated workflows depending on system configuration
* Use clear flags (e.g., `clearData`, `clearOrderItems`) to explicitly remove data
* Order item management operations (add/remove) are performed atomically
* Some fields may not be editable if the picking order is in certain workflow states
* The `customerID` can be changed but must reference a valid, accessible customer


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/mutations/updatepickingorder.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
