Skip to main content

Shipping

Purpose​

Shipping methods with per-zone flat rates, country-based shipping zones, and per-order shipments with manual carrier tracking.

Responsibilities​

  • Manage translatable shipping methods (code, active flag, position).
  • Manage shipping zones and their country coverage — a zone with no countries acts as a "rest of world" fallback.
  • Manage flat per-zone rates per method (price = 0.00 means free shipping).
  • Quote available methods + costs for a country (checkout integration via the ShippingGateway).
  • Track one shipment per order through a guarded status lifecycle and mirror the order status: shipped → order SHIPPED, delivered → order COMPLETED.

Tables​

TableDescription
shipping_methodsShipping methods (unique code, active, position)
shipping_method_translationsPer-language name/description of a method
shipping_zonesAdmin-facing zones (not translated)
shipping_zone_countriesPivot: zone ↔ core_countries.code
shipping_ratesFlat price per method per zone (unique pair)
shipping_shipmentsOne shipment per order: carrier, tracking number/URL, status, shipped/delivered timestamps, notes

Models​

ModelDescription
MethodShipping method with translations()
MethodTranslationPer-language name/description
ZoneZone with countries() BelongsToMany to Core's Country
RatePrice for a method on a zone
ShipmentStandalone model — orders are only referenced via the order gateway

Events emitted​

EventWhen
ShipmentCreatedEventA shipment is created for an order (status pending)
ShipmentShippedEventShipment transitions to shipped
ShipmentDeliveredEventShipment transitions to delivered

Also, through the Order gateway: OrderShippedEvent (shipment → shipped) and OrderCompletedEvent (shipment → delivered).

Events listened to​

EventReaction
ShipmentCreatedEvent / ShipmentShippedEvent / ShipmentDeliveredEventLogAllEvents

Dependencies​

ModuleReason
CoreContracts (events, gateways, DTOs), CountryCodeRule, core_countries, default language
OrderOrderGatewayInterface (findOrder, markAsShipped, markAsDelivered)
UserUserGatewayInterface::getAddress for checkout quotes
CartCheckout accepts shipping_method_id and passes the quote into createFromCart

Flow​