Tracking Carrier

A track­ing car­ri­er stores track­ing infor­ma­tion and has helper meth­ods to return track­ing URLs.

Attributes

Description

trackingNumber

The shipment tracking number.

order

Override the default order by specifying an integer.

Methods

Description

getName()

Returns the display name of the carrier.

getTrackingUrl()

Returns the tracking URL for the carrier formatted with the tracking number.

Reg­is­ter Cus­tom Carrier

If your car­ri­er is not avail­able in the default list, you can reg­is­ter your own.

use craft\events\RegisterComponentTypesEvent;
use tasdev\orderfulfillments\services\Carriers;
use yii\base\Event;

Event::on(Carriers::class, Carriers::EVENT_REGISTER_CARRIERS, function(RegisterComponentTypesEvent $e) {
    $e->types[] = MyCarrier::class;
});

To see what your MyCarrier class might look like, take a look at the default class­es.