Log in
Factory

ShipmentFactory

Magento\Sales\Model\Order\ShipmentFactory

What it does

This factory class creates Shipment objects for orders in Magento 2.

Developers use it when programmatically creating shipments, as it handles the complex logic of converting order items to shipment items, validating quantities, handling bundle products, and optionally adding tracking information.

It ensures proper shipment creation by managing virtual items, parent-child item relationships, and quantity constraints.

Public Methods

  • create()