# Orders

Source: https://developers.swell.is/frontend-api/orders

**Swell.js:**

Methods to retrieve order details and convert the cart to an order.

### Get order details

When a cart is submitted, the newly created order will be returned. However, you can use this method if you need to get the order information separately. You can also retrieve an order with a `checkout_id`, allowing you to display order details from an email containing a link like `https://my-store.com/order/{checkout_id}`.

Returns order with the passed ID, or if no parameters are passed, the last order placed in the current session.

**Get order details**

**swell.js** `Get an order by checkout_id`

```javascript
await swell.cart.getOrder('878663b2fb4175b128e40de428cd7b0c')
```

**swell.js** `Get the last order placed in the current session`

```javascript
await swell.cart.getOrder()
```

### Submit an order

When a customer has entered all the information needed to finalize their order, call this method to process their payment and convert the cart to an order.

Returns the newly created order.

**Submit an order**

**swell.js**

```javascript
await swell.cart.submitOrder()
```

**GraphQL:**

Methods to retrieve order details and convert the cart to an order.

### Get order details

When a cart is submitted, the newly created order will be returned. However, you can use this method if you need to get the order information separately. Returns the last order placed in the current session.

The parameters for this query are `_locale`, and `_currency`.

**Get order details**

**GraphQL**

```graphql
query {
  cart {
    dateCreated
    checkoutId
    orderId
    accountId
    account {
      name
      email
      group
    }
    items {
      product {
        id
        name
        price
      }
      quantity
      price
    }
    grandTotal
    taxTotal
    discountTotal
  }
}
```

### Submit an order

When a customer has entered all the information needed to finalize their order, call this method to process their payment and convert the cart to an order. Returns the newly created order.

The parameters for this query are `_locale`, and `_currency`.

**Submit an order**

**GraphQL**

```graphql
mutation {
  submitCartOrder {
    id
    accountId
    items {
      product {
        id
        name
        price
      }
      quantity
      taxTotal
      priceTotal
      discountTotal
    }
  }
}
```
