Log in
Interface

CarrierFactoryInterface

Magento\Shipping\Model\CarrierFactoryInterface

What it does

This interface defines a factory contract for creating and retrieving shipping carrier instances in Magento 2.

Developers use this when they need to dynamically instantiate shipping carriers (like UPS, FedEx, USPS) by their carrier code, with options to check if carriers are active before creation.

It's commonly used in checkout processes, shipping method calculations, and admin shipping configuration to load the appropriate carrier implementation.

Public Methods

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