Skip to main content

Overview

An order is the central model connecting a customer to their purchase. It collects line items, addresses, shipments, payments, and adjustments into a single transaction that flows through a checkout state machine from cart to completion. Key relationships:
  • Line Items link orders to Variants (what was purchased)
  • Shipments handle fulfillment from stock locations
  • Payments track payment attempts and their states
  • Adjustments apply taxes, promotions, and shipping costs
  • Addresses store billing and shipping information

Order Attributes

The API returns these key fields on every order: The display_* fields return formatted strings with currency symbols (e.g., "$15.99").

Cart

A cart is simply an order in the cart state. Guest carts are identified by a cart token; authenticated users’ carts are linked to their account.
Every item mutation returns the full updated order with recalculated totals.

Checkout Flow

The checkout is a state machine that advances the order through a series of steps. Each step collects required information before allowing the order to proceed.
1

cart

Customer has items in their cart. This is the starting state.
2

address

Customer provides shipping and billing addresses.
3

delivery

Customer selects a shipping rate for each shipment.
4

payment

Customer provides payment. Skipped if the order is fully covered by store credit.
5

confirm

Customer reviews and confirms the order.
6

complete

Order is placed. completed_at is set and fulfillment begins.
If the order doesn’t meet the requirements for the next state (e.g., missing address), the API returns an error.

Coupon Codes

Apply or remove promotional coupon codes during checkout:

Order History

Authenticated customers can view their past orders:

Managing Orders

Everything above is the Store API — the customer’s own cart and orders. Back-office order management (listing every order, creating phone/manual orders, capturing payments, cancelling) uses the Admin API.

Listing and creating orders

List orders with Ransack filters and pagination (state_eq, limit, sorting). A draft order is created in one call; pass line items as items (each { variant_id, quantity }):

Order state actions

Orders move through their state machine via dedicated actions rather than raw state writes:

Payments and refunds

Capture or void an authorized payment, and issue refunds, through the nested order resources:

Line Items

Line items represent individual products in an order. Each line item links to a Variant and tracks the quantity and price at the time of purchase. When a variant is added to an order, the price is locked on the line item. If the variant’s price changes later, existing orders are unaffected.

Adjustments

Adjustments modify an order’s total — promotions decrease it, taxes and shipping increase it. Adjustments can be applied at the order level, the line item level, or the shipment level.

Payment States

Fulfillment Statuses

The order’s fulfillment_status field summarizes the state of all fulfillments (the Store API/SDK exposes shipments as fulfillments). For more details, see Shipments and Payments.