<commit_before>---
title: "Orders"
section: core
---

## Overview

The `Order` model is one of the key models in Spree. It provides a central place around which to collect information about a customer order - including line items, adjustments, payments, addresses, return authorizations, and shipments.

Orders have the following attributes:

* `number`: The unique identifier for this order. It begins with the letter R and ends in a 9-digit number. This number is shown to the users, and can be used to find the order by calling `Spree::Order.find_by_number(number)`.
* `item_total`: The sum of all the line items for this order.
* `adjustment_total`: The sum of all adjustments on this order.
* `total`: The result of `item_total` minus the `adjustment_total`.
* `state`: The current state of the order. To read more about the states an order goes through, read [The Order State Machine](#state_machine) section of this guide.
* `email`: The email address for the user who placed this order. Stored in case this order is for a guest user.
* `user_id`: The ID for the corresponding user record for this order. Stored only if the order is placed by a signed-in user.
* `completed_at`: The timestamp of when the order was completed.
* `bill_address_id`: The ID for the related `Address` object with billing address information.
* `ship_address_id`: The ID for the related `Address` object with shipping address information.
* `shipment_state`: The current shipment state of the order. For possible states, please see the Shipping guide. TODO: Find where shipment_states are described and link to them.
* `payment_state`: The current payment state of the order. For possible states, please see the <%= link_to "Payments guide", :payments %>.
* `special_instructions`: Any special instructions for the store to do with this order. Will only appear if `Spree::Config[:shipping_instructions]` is set to `true`.
* `currency`: The currency for this order. Determined by the `Spree::Config[:currency]` value that was set at the time of order.
* `last_ip_address`: The last IP address used to update this order in the frontend.

## <a id="state_machine"></a>The Order State Machine

Orders flow through a state machine, beginning at a `cart` state and ending up at a `complete` state. The intermediary states can be configured using the <%= link_to "Checkout Flow API", :checkout %>.

The default states are as follows:

* `cart`
* `address`<commit_msg>[dev] Correct documentation about the total on orders<commit_after>---
title: "Orders"
section: core
---

## Overview

The `Order` model is one of the key models in Spree. It provides a central place around which to collect information about a customer order - including line items, adjustments, payments, addresses, return authorizations, and shipments.

Orders have the following attributes:

* `number`: The unique identifier for this order. It begins with the letter R and ends in a 9-digit number. This number is shown to the users, and can be used to find the order by calling `Spree::Order.find_by_number(number)`.
* `item_total`: The sum of all the line items for this order.
* `adjustment_total`: The sum of all adjustments on this order.
* `total`: The result of the sum of the `item_total` and the `adjustment_total`.
* `state`: The current state of the order. To read more about the states an order goes through, read [The Order State Machine](#state_machine) section of this guide.
* `email`: The email address for the user who placed this order. Stored in case this order is for a guest user.
* `user_id`: The ID for the corresponding user record for this order. Stored only if the order is placed by a signed-in user.
* `completed_at`: The timestamp of when the order was completed.
* `bill_address_id`: The ID for the related `Address` object with billing address information.
* `ship_address_id`: The ID for the related `Address` object with shipping address information.
* `shipment_state`: The current shipment state of the order. For possible states, please see the Shipping guide. TODO: Find where shipment_states are described and link to them.
* `payment_state`: The current payment state of the order. For possible states, please see the <%= link_to "Payments guide", :payments %>.
* `special_instructions`: Any special instructions for the store to do with this order. Will only appear if `Spree::Config[:shipping_instructions]` is set to `true`.
* `currency`: The currency for this order. Determined by the `Spree::Config[:currency]` value that was set at the time of order.
* `last_ip_address`: The last IP address used to update this order in the frontend.

## <a id="state_machine"></a>The Order State Machine

Orders flow through a state machine, beginning at a `cart` state and ending up at a `complete` state. The intermediary states can be configured using the <%= link_to "Checkout Flow API", :checkout %>.

The default states are as follows:

* `cart`
* `address`
{'fraction_non_alphanumeric': 0.07970867893991503, 'fraction_numerical': 0.00040461258345134534, 'mean_word_length': 4.722222222222222, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3418721', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1266, 'n_words': 718}