Frage

I want to add a new carrier to the dropdown menu inside the shipment tab of a order, to select a custom carrier.

I already tried this https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout-add-custom-carrier.html but that is adding a custom shipping method in the checkout, not to select a carrier inside a order.

How can I achieve that?

War es hilfreich?

Lösung

In your carrier model, you need to add the function to enable this shipping method to appear in the backend when your tracking information becomes available.

/**
     * Check if carrier has shipping tracking option available
     *
     * All \Magento\Usa carriers have shipping tracking option available
     *
     * @return boolean
     */
    public function isTrackingAvailable()
    {
        return true;
    }

However, you also want to hide the carrier in the checkout, to do this,

/**
     * @inheritDoc
     */
    public function collectRates(RateRequest $request)
    {
        return false;
    }

see an example of carrier behaving like you describe at: https://bitbucket.org/magstaging/carrier/src/master/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top