Log in
Factory

CarrierFactory

Magento\Shipping\Model\CarrierFactory

What it does

This factory class creates shipping carrier instances based on carrier codes (like 'ups', 'fedex', 'usps').

Developers use it to instantiate carrier models dynamically when calculating shipping rates, validating tracking numbers, or managing shipping methods.

It provides methods to retrieve carriers with singleton or new instances, optionally checking if the carrier is active in configuration.

Public Methods

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