Models
Shopper uses five models to manage orders:Extending the Model
config/shopper/models.php:
Database Schema
Order Table
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | bigint | no | auto | Primary key |
number | string(32) | no | - | Order number |
price_amount | integer | yes | null | Order price override (in cents) |
status | string(32) | no | new | Order status enum |
payment_status | string(32) | no | pending | Payment status enum |
shipping_status | string(32) | no | unfulfilled | Shipping status enum |
currency_code | string | no | - | Currency code (USD, EUR, etc.) |
notes | text | yes | null | Order notes |
parent_order_id | bigint | yes | null | FK to parent order |
payment_method_id | bigint | yes | null | FK to payment method |
channel_id | bigint | yes | null | FK to channel |
customer_id | bigint | yes | null | FK to user |
zone_id | bigint | yes | null | FK to zone |
billing_address_id | bigint | yes | null | FK to order address |
shipping_address_id | bigint | yes | null | FK to order address |
shipping_option_id | bigint | yes | null | FK to carrier option |
cancelled_at | timestamp | yes | null | Cancellation date |
archived_at | timestamp | yes | null | Archive date |
deleted_at | timestamp | yes | null | Soft delete timestamp |
created_at | timestamp | yes | null | Creation timestamp |
updated_at | timestamp | yes | null | Last update timestamp |
OrderItem Table
| Column | Type | Nullable | Description |
|---|---|---|---|
id | bigint | no | Primary key |
name | string | yes | Product name at time of purchase |
sku | string | yes | Product SKU at time of purchase |
quantity | integer | no | Quantity ordered |
unit_price_amount | integer | no | Unit price (in cents) |
product_id | bigint | no | Polymorphic relation ID |
product_type | string | no | Polymorphic relation type |
order_id | bigint | no | FK to order |
order_shipping_id | bigint | yes | FK to order_shipping (shipment) |
fulfillment_status | string | yes | Fulfillment status enum value |
OrderAddress Table
| Column | Type | Nullable | Description |
|---|---|---|---|
id | bigint | no | Primary key |
customer_id | bigint | no | FK to user |
first_name | string | no | First name |
last_name | string | no | Last name |
company | string | yes | Company name |
street_address | string | no | Street address |
street_address_plus | string | yes | Additional address line |
postal_code | string | no | Postal/ZIP code |
city | string | no | City |
state | string | yes | State/province/region |
phone | string | yes | Phone number |
country_name | string | yes | Country name |
OrderShipping Table
| Column | Type | Nullable | Description |
|---|---|---|---|
id | bigint | no | Primary key |
status | string(32) | yes | Shipment status enum |
shipped_at | datetime | yes | Shipment date |
received_at | datetime | yes | Delivery date |
returned_at | datetime | yes | Return date |
tracking_number | string | yes | Carrier tracking number |
tracking_url | string | yes | Tracking URL |
voucher | json | yes | Shipping voucher data |
order_id | bigint | no | FK to order |
carrier_id | bigint | yes | FK to carrier |
OrderRefund Table
| Column | Type | Nullable | Description |
|---|---|---|---|
id | bigint | no | Primary key |
refund_reason | string | yes | Refund reason |
refund_amount | integer | yes | Refund amount (in cents) |
status | string | no | Refund status enum |
currency | string | no | Currency code |
notes | string | yes | Admin notes |
order_id | bigint | no | FK to order |
user_id | bigint | yes | FK to user processing refund |
Order Status
Every order tracks three independent statuses: order status, payment status, and shipping status. This separation allows each aspect of the order to progress independently — for example, an order can be paid before it’s shipped, or partially shipped while still processing.Order Status
TheOrderStatus enum tracks the overall lifecycle of the order:
| Status | Database Value | Color | Description |
|---|---|---|---|
| New | new | info | Newly placed order |
| Processing | processing | primary | Order is being prepared |
| Completed | completed | teal | Order fulfilled and delivered |
| Cancelled | cancelled | danger | Order cancelled |
| Archived | archived | gray | Removed from active list |
Payment Status
ThePaymentStatus enum tracks whether payment has been collected. It is updated automatically by the PaymentProcessingService as transactions succeed.
| Status | Database Value | Color | Description |
|---|---|---|---|
| Pending | pending | warning | Awaiting payment |
| Authorized | authorized | info | Funds held, not yet captured |
| Paid | paid | success | Funds collected |
| Partially Refunded | partially_refunded | orange | Some amount refunded |
| Refunded | refunded | gray | Full amount refunded |
| Voided | voided | danger | Cancelled before capture |
For the full payment lifecycle, capture strategies, and transaction recording, see the Payments page.
Shipping Status
TheShippingStatus enum tracks the overall shipping state at the order level. It reflects the combined state of all shipments on the order.
| Status | Database Value | Color | Description |
|---|---|---|---|
| Unfulfilled | unfulfilled | warning | No items shipped yet |
| Partially Shipped | partially_shipped | info | Some items shipped |
| Shipped | shipped | indigo | All items shipped |
| Partially Delivered | partially_delivered | primary | Some packages delivered |
| Delivered | delivered | success | All packages delivered |
| Partially Returned | partially_returned | orange | Some items returned |
| Returned | returned | gray | All items returned |
For shipment-level tracking (individual packages with carriers and tracking numbers), see the Fulfillment page.
Status Check Methods
Fulfillment Status
TheFulfillmentStatus enum tracks individual item fulfillment, enabling partial shipments and multi-carrier delivery:
| Status | Database Value | Color | Description |
|---|---|---|---|
| Pending | pending | warning | Awaiting processing |
| Forwarded to Supplier | forwarded_to_supplier | info | Sent to external supplier (dropshipping) |
| Processing | processing | primary | Being prepared |
| Shipped | shipped | indigo | In transit |
| Delivered | delivered | success | Received by customer |
| Cancelled | cancelled | danger | Fulfillment cancelled |
FulfillmentStatus is applied per item, not per order. This allows partial fulfillment when items ship at different times or from different carriers. See the Fulfillment page for complete workflows.Refund Status
TheOrderRefundStatus enum defines refund states:
Relationships
Customer
Items
Addresses
Shipping
Item Shipment
For complete multi-shipment and dropshipping workflows, see the Fulfillment page.
Refund
Channel and Zone
Parent/Child Orders
Computed Values
Order Total
Events
Order lifecycle events are dispatched automatically throughout the order lifecycle:Creating Orders
Basic Order
Complete Order with Items and Addresses
Retrieving Orders
Order Number Generation
Use thegenerate_number() helper to create unique order numbers:
Components
config/shopper/components/order.php:
Storefront Example
Order Status Flow
| From Status | Possible Transitions |
|---|---|
| New | Processing, Cancelled, Archived |
| Processing | Completed, Cancelled |
| Completed | Archived |
| Cancelled | (terminal state) |
| Archived | (terminal state) |