# Mutations / Orders

# Orders

**Mutation**
## addOrderReviewComment — Returns [OrderActivity](/documentation/Objects/Orders#OrderActivity)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Add a comment to the provided review

| Arguments | Type | Description |
| --- | --- | --- |
| review | [ID!](/documentation/Types/UUID#UUID) | The ID of the order review the comment is being added to |
| to | [OrderActivityCommentToEnum!](/documentation/Enums/Orders#OrderActivityCommentToEnum) | What the comment should be applied to, if PRODUCT is specified, `id` must be provided |
| id | [ID](/documentation/Types/UUID#UUID) | The ID of the product to apply the comment to, should only be provided when PRODUCT is specified in `to` |
| comment | *String!* | The comment to add to the review |

**Example Mutation**

```graphql
mutation AddOrderReviewComment($review: ID!, $to: OrderActivityCommentToEnum!, $comment: String!) {
    addOrderReviewComment(review: $review, to: $to, comment: $comment) {
        processTime
    }
}

# Example variables
{
    "review": "<REVIEW>",
    "to": "ORDER",
    "comment": "<COMMENT>"
}
```

**Mutation**
## cancelOrder — Returns [Order](/documentation/Objects/Orders#Order)

**Scopes required:** stock_delete

Cancel an existing order, this won't adjust any inventory

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order to cancel |

**Example Mutation**

```graphql
mutation CancelOrder($id: ID!) {
    cancelOrder(id: $id) {
        id,
        type,
        status,
        completed,
        undergoingReview
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## createOrder — Returns [Order](/documentation/Objects/Orders#Order)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Create a new order, you can also generate orders through this mutation

| Arguments | Type | Description |
| --- | --- | --- |
| type | [OrderTypeEnum!](/documentation/Enums/Orders#OrderTypeEnum) | The type of order to create |
| from | [ID](/documentation/Types/UUID#UUID) | Where the order is from, or null if from all suppliers (orders only) |
| to | [ID!](/documentation/Types/UUID#UUID) | Who the order is to |
| orderDate | [Date](/documentation/Types/Date#Date) | The date of the order / invoice / transfer, defaults to today's date |
| dueDate | [Date](/documentation/Types/Date#Date) | The date that the order is due to be received / paid |
| invoiceNumber | *String* | The invoice / order number of the order |
| feePercentage | *Float* | The order fee percentage |
| enteredAs | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | How the costs should be displayed on the order page (Does not represent how the cost values are actually stored) |
| reference | *String* | The reference number of the order |
| notes | *String* | Any public notes about this order, this can be printed out on the order |
| internalNotes | *String* | Any internal notes about this order, this will not be displayed outside Shopfront |
| includeFreight | *Boolean* | Whether the invoice includes freight or not, defaults to true |
| mergeable | *Boolean* | Whether the order should be able to be merged, note this does not affect merging through the API, only through the UI, defaults to TRUE except for when order type is set to RECEIVE |
| products | [[OrderProductInput]](/documentation/Inputs/Orders#OrderProductInput) | The products on the order, not valid to use when generating an order |
| generate | [OrderGenerationInput](/documentation/Inputs/Orders#OrderGenerationInput) | How the order should be generated, not valid to use when providing a list of products |

**Example Mutation**

```graphql
mutation CreateOrder($type: OrderTypeEnum!, $to: ID!) {
    createOrder(type: $type, to: $to) {
        id,
        type,
        status,
        completed,
        undergoingReview
    }
}

# Example variables
{
    "type": "ORDER",
    "to": "<TO>"
}
```

**Mutation**
## createOrderByMatch — Returns [Order](/documentation/Objects/Orders#Order)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Create a new order

| Arguments | Type | Description |
| --- | --- | --- |
| type | [OrderTypeEnum!](/documentation/Enums/Orders#OrderTypeEnum) | The type of order to create |
| from | [ID!](/documentation/Types/UUID#UUID) | Where the order is from |
| to | [ID!](/documentation/Types/UUID#UUID) | Who the order is to |
| orderDate | [Date](/documentation/Types/Date#Date) | The date of the order / invoice / return, defaults to today's date |
| dueDate | [Date](/documentation/Types/Date#Date) | The date that the order is due to be received / paid |
| invoiceNumber | *String* | The invoice / order number of the order |
| feePercentage | *Float* | The order fee percentage |
| enteredAs | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | How the costs should be displayed on the order page (Does not represent how the cost values are actually stored) |
| reference | *String* | The reference number of the order |
| notes | *String* | Any public notes about this order, this can be printed out on the order |
| internalNotes | *String* | Any internal notes about this order, this will not be displayed outside Shopfront |
| attachments | [[OrderAttachmentInput!]](/documentation/Inputs/Orders#OrderAttachmentInput) | A list of URL attachments to add to the order |
| includeFreight | *Boolean* | Whether the invoice includes freight or not, defaults to true |
| expectedTotal | *Float* | The expected total of the invoice |
| totalFees | *Float* | The total fees, this will be automatically distributed across each product as per the supplier settings, this cannot be used when specifying fees individually |
| totalFreight | *Float* | The total freight, this will be automatically distributed across each product as per the supplier settings, this cannot be used when specifying freight individually |
| mergeable | *Boolean* | Whether the order should be able to be merged, note this does not affect merging through the API, only through the UI, defaults to TRUE except for when order type is set to RECEIVE |
| products | [[OrderProductMatchInput]](/documentation/Inputs/Orders#OrderProductMatchInput) | The products on the order, not valid to use when generating an order |

**Example Mutation**

```graphql
mutation CreateOrderByMatching($type: OrderTypeEnum!, $from: ID!, $to: ID!) {
    createOrderByMatch(type: $type, from: $from, to: $to) {
        id,
        type,
        status,
        completed,
        undergoingReview
    }
}

# Example variables
{
    "type": "ORDER",
    "from": "<FROM>",
    "to": "<TO>"
}
```

**Mutation**
## createOrderReview — Returns [OrderReview](/documentation/Objects/Orders#OrderReview)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Create a new review for an existing order, reviews can also be automatically created on the store's settings

| Arguments | Type | Description |
| --- | --- | --- |
| order | [ID!](/documentation/Types/UUID#UUID) | The ID of the order to create the review for |
| reviewers | [[ID!]](/documentation/Types/UUID#UUID) | A list of people to review the order, if they don't have permission to review the order they will be automatically removed. If this is not specified or null, then the default reviewers will be added |

**Example Mutation**

```graphql
mutation CreateOrderReview($order: ID!) {
    createOrderReview(order: $order) {
        id,
        status,
        orderStatus,
        createdAt
    }
}

# Example variables
{
    "order": "<ORDER>"
}
```

**Mutation**
## deleteOrderAttachment — Returns [MediaAttachment](/documentation/Objects/Media-Attachment#MediaAttachment)

**Scopes required:** stock_edit_order, delete_order_attachment

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order attachment to delete |

**Example Mutation**

```graphql
mutation DeleteOrderAttachment($id: ID!) {
    deleteOrderAttachment(id: $id) {
        id,
        name,
        url,
        mimeType,
        thumbnail
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## deleteOrderReviewAttachment — Returns [MediaAttachment](/documentation/Objects/Media-Attachment#MediaAttachment)

**Scopes required:** review_order, delete_order_attachment

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order review attachment to delete |

**Example Mutation**

```graphql
mutation DeleteOrderReviewAttachment($id: ID!) {
    deleteOrderReviewAttachment(id: $id) {
        id,
        name,
        url,
        mimeType,
        thumbnail
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## markOrdersAsRelated — Returns *boolean*

**Scopes required:** stock_edit_order

This marks multiple orders as being related to a single invoice, it doesn't affect the invoice in any way

| Arguments | Type | Description |
| --- | --- | --- |
| orders | [[ID!]!](/documentation/Types/UUID#UUID) | The orders to be marked as related |
| relateTo | [ID!](/documentation/Types/UUID#UUID) | The ID of the order that the `orders` relate to |
| clearCurrentlyRelated | *Boolean* | Whether we should clear all of the `orders` that relate to the `relateTo` before applying the new `orders` |

**Example Mutation**

```graphql
mutation MarkOrdersAsRelated($orders: [ID!]!, $relateTo: ID!) {
    markOrdersAsRelated(orders: $orders, relateTo: $relateTo)
}

# Example variables
{
    "orders": [
        "<ORDERS>"
    ],
    "relateTo": "<RELATE_TO>"
}
```

**Mutation**
## markReviewAsCancelled — Returns [OrderReview](/documentation/Objects/Orders#OrderReview)

**Scopes required:** review_order

Mark a review as cancelled, a new review will need to be created before processing the order

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the review to cancel |

**Example Mutation**

```graphql
mutation MarkReviewAsCancelled($id: ID!) {
    markReviewAsCancelled(id: $id) {
        id,
        status,
        orderStatus,
        createdAt
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## markReviewAsCompleted — Returns [OrderReview](/documentation/Objects/Orders#OrderReview)

**Scopes required:** review_order

Mark a review as completed, this will then allow you to continue to process the order

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the review to complete |

**Example Mutation**

```graphql
mutation MarkReviewAsCompleted($id: ID!) {
    markReviewAsCompleted(id: $id) {
        id,
        status,
        orderStatus,
        createdAt
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## receiveOrder — Returns [OrderReceiveResults](/documentation/Objects/Orders#OrderReceiveResults)

**Scopes required:** stock_receive

Receive an order, this will update inventory and costs for all products on the order

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order to receive |

**Example Mutation**

```graphql
mutation ReceiveOrder($id: ID!) {
    receiveOrder(id: $id) {
        __typename
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## reopenOrder — Returns [Order](/documentation/Objects/Orders#Order)

**Scopes required:** stock_edit_order

Reopen an order that has been sent

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the sent order to reopen |

**Example Mutation**

```graphql
mutation ReopenOrder($id: ID!) {
    reopenOrder(id: $id) {
        id,
        type,
        status,
        completed,
        undergoingReview
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## reopenReview — Returns [OrderReview](/documentation/Objects/Orders#OrderReview)

**Scopes required:** review_order

Reopen a completed review, marking as in progress

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the review to reopen |

**Example Mutation**

```graphql
mutation ReopenReview($id: ID!) {
    reopenReview(id: $id) {
        id,
        status,
        orderStatus,
        createdAt
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## sendOrder — Returns [OrderSendResults](/documentation/Objects/Orders#OrderSendResults)

**Scopes required:** stock_send

This will mark an order as sent, if this order is from multiple suppliers, it will split into several orders

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order to send |

**Example Mutation**

```graphql
mutation SendOrder($id: ID!) {
    sendOrder(id: $id) {
        __typename
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## updateOrder — Returns [Order](/documentation/Objects/Orders#Order)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Update an existing order

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the order to update |
| from | [ID](/documentation/Types/UUID#UUID) | Where the order is from, if not specified it won't change where the order is from |
| to | [ID](/documentation/Types/UUID#UUID) | Where the order is to, if not specified it won't change where the order is to |
| status | [OrderStatusEnum](/documentation/Enums/Orders#OrderStatusEnum) | What status the order is at when the update was expected, this is used just for validation |
| orderDate | [Date](/documentation/Types/Date#Date) | The date of the order / invoice / transfer |
| dueDate | [Date](/documentation/Types/Date#Date) | The date that the order is due to be received / paid |
| invoiceNumber | *String* | The invoice / order number |
| reference | *String* | The reference for this order |
| enteredAs | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | How the costs should be displayed on the order page (Does not represent how the cost values are actually stored) |
| notes | *String* | Any public notes about the order, this can be printed |
| internalNotes | *String* | Any internal notes about this order, this will not be displayed outside Shopfront |
| includeFreight | *Boolean* | Whether the invoice includes freight or not |
| expectedTotal | *Float* | The total that the invoice is expected to match to |
| feePercentage | *Float* | The order fee percentage |
| products | [[OrderProductInput]](/documentation/Inputs/Orders#OrderProductInput) | The products on the order |

**Example Mutation**

```graphql
mutation UpdateOrder($id: ID!) {
    updateOrder(id: $id) {
        id,
        type,
        status,
        completed,
        undergoingReview
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## updateOrderReviewerStatus — Returns [OrderReviewer](/documentation/Objects/Orders#OrderReviewer)

**Scopes required:** review_order

Modify a user's review on an in progress review

| Arguments | Type | Description |
| --- | --- | --- |
| review | [ID!](/documentation/Types/UUID#UUID) | The ID of the review to modify the reviewers on |
| reviewer | [ID!](/documentation/Types/UUID#UUID) | The reviewer to change the review status for |
| status | [OrderReviewerStatusEnum!](/documentation/Enums/Orders#OrderReviewerStatusEnum) | The status to change to |

**Example Mutation**

```graphql
mutation UpdateOrderReviewerStatus($review: ID!, $reviewer: ID!, $status: OrderReviewerStatusEnum!) {
    updateOrderReviewerStatus(review: $review, reviewer: $reviewer, status: $status) {
        status
    }
}

# Example variables
{
    "review": "<REVIEW>",
    "reviewer": "<REVIEWER>",
    "status": "NO_REVIEW"
}
```

**Mutation**
## updateOrderReviewers — Returns [[OrderReviewer]](/documentation/Objects/Orders#OrderReviewer)

**Scopes required:** modify_order_reviewers

Modify who the reviewers are for an order review, any reviewer who has already reviewed cannot be removed

| Arguments | Type | Description |
| --- | --- | --- |
| review | [ID!](/documentation/Types/UUID#UUID) | The ID of the review to modify the reviewers on |
| reviewers | [[ID!]!](/documentation/Types/UUID#UUID) | The reviewers to assign to the order, any new reviewers will be notified |

**Example Mutation**

```graphql
mutation UpdateOrderReviewers($review: ID!, $reviewers: [ID!]!) {
    updateOrderReviewers(review: $review, reviewers: $reviewers) {
        status
    }
}

# Example variables
{
    "review": "<REVIEW>",
    "reviewers": [
        "<REVIEWERS>"
    ]
}
```