Skip to main content
Orders represent customer purchases and are central to your e-commerce operations. Shopper provides a comprehensive order management system with support for items, addresses, shipping, refunds, and status tracking.

Models

Shopper uses seven models to manage orders: The Order model implements Shopper\Core\Models\Contracts\Order and uses SoftDeletes. It is configurable via config/shopper/models.php.

Extending the Model

To add custom behavior, extend the model and update your configuration:
Update config/shopper/models.php:

Database Schema

Order Table

OrderItem Table

OrderAddress Table

OrderShipping Table

OrderRefund Table

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

The OrderStatus enum tracks the overall lifecycle of the order:

Payment Status

The PaymentStatus enum tracks whether payment has been collected. It is updated automatically by the PaymentProcessingService as transactions succeed.
For the full payment lifecycle, capture strategies, and transaction recording, see the Payments page.

Shipping Status

The ShippingStatus enum tracks the overall shipping state at the order level. It reflects the combined state of all shipments on the order.
For shipment-level tracking (individual packages with carriers and tracking numbers), see the Fulfillment page.

Status Check Methods

Fulfillment Status

The FulfillmentStatus enum tracks individual item fulfillment, enabling partial shipments and multi-carrier delivery:
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

The OrderRefundStatus enum defines refund states:

Relationships

Customer

Items

To add an item to an order, retrieve the product price for the order’s currency:

Addresses

Shipping

To create a shipment and link items:

Item Shipment

For complete multi-shipment and dropshipping workflows, see the Fulfillment page.

Refund

To create a refund:

Channel and Zone

Discount

Orders snapshot the discount that was redeemed at placement time. The discount_id foreign key still resolves the original Discount model while it exists, but the four snapshot columns (discount_code, discount_type, discount_value_at_apply, discount_currency_code) preserve the data even after the originating discount is edited or deleted. This follows the Shopify pattern of immutable order records.
To find every order that redeemed a given discount, use the same query Shopper uses internally to enforce the per-user usage limit:
For the full validation and atomic reservation rules, see Usage Limit Enforcement on the Discounts page.

Parent/Child Orders

For split orders, an order can have a parent and children:

Computed Values

Order Total

The total() method returns the sum of all item totals in cents:

Events

Order lifecycle events are dispatched automatically throughout the order lifecycle:
For the full events reference including shipment events, payload details, and usage examples, see the Events page.

Creating Orders

Basic Order

Complete Order with Items and Addresses

Create the shipping and billing addresses:

Query Scopes

The Order model provides two scopes for filtering by archive status:

Retrieving Orders

To get all non-archived orders with their relationships:
Query orders by customer with pagination:
Find an order by number:

Order Number Generation

Use the generate_number() helper to create unique order numbers:
This returns a formatted string like ORD-20260327-001234. The format is configurable in config/shopper/orders.php.

Permissions

The admin panel generates five permissions for order management:

Components

To customize the admin UI for order management:
Creates config/shopper/components/order.php:

Storefront Example

In most cases, orders are created automatically when a cart is converted via CreateOrderFromCartAction. You rarely need to create orders manually. Here is how the checkout flow and order display work:
The CreateOrderFromCartAction handles everything in a single transaction: calculating totals, creating addresses, creating order items, applying discounts, computing taxes, and marking the cart as completed. See the Cart page for details.

Order Status Flow