Log in
Factory

CarrierFactory

Magento\Shipping\Model\CarrierFactory

What it does

The CarrierFactory class creates instances of shipping carrier models in Magento 2.

Developers use this factory to instantiate shipping carriers (like UPS, FedEx, USPS) either as singleton instances or new objects, with optional validation to ensure the carrier is active in the configuration.

It retrieves the carrier's class name from the store configuration and manages instantiation through the ObjectManager.

Public Methods

  • get()
  • create()
  • getIfActive()
  • createIfActive()