4

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?

1
  • is the change your are trying to do in the backend? can't see any dropdown there.. Commented May 26, 2020 at 14:56

1 Answer 1

8

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/

2
  • Thanks again Herve!
    – JGeer
    Commented May 27, 2020 at 7:04
  • 1
    This comment was the missing link to add tracking links for a custom carrier. First, I followed the Add custom shipping carrier tutorial in Magento DevDocs. Second, I installed this free module available on Github that enables tracking links in emails. Edit this module's config.xml / system.xml to add the xml tag used in the custom carrier module, and you get custom tracking in emails. isTrackingAvailable() method is what enables the dropdown in admin.
    – Chrysippus
    Commented Jul 12, 2020 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.