---
search:
  tags:
    - Orders
    - PUT
seo:
  description: >-
    Updates an order that is in checkout state. Use this to set or modify…
    Reference for the PUT /shops/{shop_id}/orders/{code} endpoint in the Bolder
    API v1.
sidebar:
  label: Update order
  badge: PUT
title: Update order
type: openapi-operation
---
Updates an order that is in `checkout` state. Use this to set or modify line items,
contact information, and shipping address. Requires `admin` scope.

The returned order includes `btc:web_checkout` and `btc:web_cart` links for directing
customers to complete payment.

**Line item tips:**
- Pass `units: -1` to remove a line item
- Contact is matched by `email`; new contacts require `name` and `phone_number` too

`PUT /shops/{shop_id}/orders/{code}`

**Request body** (`application/json`, required)

- `line_items` (LineItemInput[]) — Pass \`units: -1\` to remove a variant from the order
- `contact` (ContactInput)
- `address` (object)

Request body example:

```json
{
  "line_items": [
    {
      "variant_id": 0,
      "units": 0
    }
  ],
  "contact": {
    "email": "string",
    "name": "string",
    "phone_number": "string",
    "company": "string"
  },
  "address": {
    "id": 0
  }
}
```

**Responses**

- `200` — Order updated
- `422` — Validation errors

Response example, 200:

```json
{
  "id": 0,
  "shop_id": 0,
  "code": "string",
  "status": "checkout",
  "net_total": 0,
  "total": 0,
  "shipping_total": 0,
  "shipping_description": "string",
  "discount_total": 0,
  "tracking_code": "string",
  "courier_name": "string",
  "total_weight_in_grams": 0,
  "created_on": "2019-08-24T14:15:22Z",
  "updated_on": "2019-08-24T14:15:22Z",
  "pending_on": "2019-08-24T14:15:22Z",
  "closed_on": "2019-08-24T14:15:22Z",
  "shipped_on": "2019-08-24T14:15:22Z",
  "fulfillment": {
    "fulfillment_method": "shipping"
  },
  "payment_info": {
    "type": "string",
    "name": "string",
    "auth_code": "string",
    "transaction_id": "string"
  },
  "_links": {},
  "_embedded": {
    "contact": {
      "id": 0,
      "name": "string",
      "email": "string",
      "phone_number": "string"
    },
    "address": {
      "street": "string",
      "street_2": "string",
      "locality_name": "string",
      "region_name": "string",
      "country_name": "string",
      "country_code": "string",
      "postal_code": "string",
      "lat_long": "string"
    },
    "line_items": [
      {
        "product_id": 0,
        "product_title": "string",
        "unit_price": 0,
        "units": 0,
        "discount_total": 0,
        "net_total": 0,
        "total": 0,
        "variant_id": 0,
        "variant_title": "string",
        "variant_sku": "string",
        "weight_in_grams": 0
      }
    ],
    "promotion": {
      "name": "string",
      "discount": 0,
      "discount_type": "$",
      "free_shipping": true
    },
    "discounts": [
      {}
    ]
  }
}
```

Response example, 422:

```json
{
  "_class": [
    "errors"
  ],
  "_embedded": {
    "errors": [
      {
        "_class": [
          "error"
        ],
        "field": "product.title",
        "messages": [
          "can't be blank"
        ]
      }
    ]
  }
}
```
