Skip to main content
Shopper dispatches events at key moments in the order, product, and cart lifecycle. These events allow you to hook into the system and add custom behavior like sending notifications, syncing with external services, updating analytics, or triggering workflows without modifying any Shopper code. Events are organized by domain across two namespaces:
  • Shopper\Core\Events order and product events
  • Shopper\Cart\Events cart events

Listening to Events

Register listeners in your application’s EventServiceProvider or use Laravel’s event discovery:
Every event carries the relevant model as a public property, accessible directly in your listener:

Order Events

Order events cover the full lifecycle of a purchase, from creation to completion, cancellation, or archival.

Available Events

All order events carry a single public Order $order property.

Lifecycle Flow

How They Are Dispatched

OrderCreated and OrderDeleted are dispatched automatically via the model observer. They fire on every insert and soft-delete, regardless of where the operation originates.
Status-related events (OrderPaid, OrderCompleted, OrderCancelled, OrderArchived) are dispatched from the admin panel when an administrator changes the order status. OrderShipped is dispatched by SyncOrderShippingStatusAction when the aggregated shipping status of all items transitions to Shipped. This happens automatically after shipment events are recorded, so you don’t dispatch it manually.

Queueing

All order events implement ShouldDispatchAfterCommit, meaning listeners run on the queue after the database transaction commits.

Shipment Events

Shipment events track the creation and delivery of individual packages within an order. A single order can have multiple shipments.

Available Events

Both shipment events carry two properties: the order and the specific shipment. This is useful when an order has multiple packages and you need to know which one was created or delivered.

Shipment vs Order Events

Shipment events fire at the package level, order events fire at the order level:

Product Events

Product events are dispatched when products are created, updated, or deleted through the admin panel.

Available Events

All product events implement ShouldDispatchAfterCommit, so listeners run on the queue after the database transaction commits.

Example: Order Notification System

Here’s how you might use Shopper events to build a notification flow for your store. Each listener handles a single responsibility. Register your listeners:
A listener that sends a shipping confirmation:

Cart Events

Cart events are dispatched when a cart reaches a key state during the checkout process.

Available Events

Cart events are in the Shopper\Cart\Events namespace:

Example: Sending a Cart Recovery Email on Coupon Removal

All Events Reference