Magento 2 Extensions:Custom Carrier Trackers

From XTENTO Support Wiki
Jump to: navigation, search
This is a guide for Magento 2. For Magento 1 extensions and guides, please refer to Magento 1 Guides.

Custom carrier trackers noborder small.png
Buy-now.png

Contents

Overview

Add custom tracking methods to Magento and make tracking links in emails clickable for your customers. All using the Custom Carrier Trackers extension by XTENTO.

Out of the box, Magento only offers three tracking methods: UPS, USPS and FedEx. That's often not enough. In case you want to add custom tracking methods to Magento, because you're shipping using a custom carrier for example and want your customers to be able to track their orders shipped using these custom carriers, this extension is the way to go.

Interested in this Magento Extension?

Head over to our store to purchase this extension: Custom Carrier Trackers (Magento 2)

Got questions? Feel free to contact us! Contact Form

Setting up the extension

The configuration section of this extension is located at System > XTENTO Extensions > Custom Carrier Trackers and should be pretty much self-explanatory. Just make sure you set the module to Enabled and make sure that the trackers you want to use are set to Enabled as well.

Setting up a new tracking method

Setting up a new tracking method is easy. Just open the configuration section and set Enabled to Yes for one of the 30 ready-to-use trackers.

When setting up the tracking URL, some variables can be used which get replaced in the tracking URL sent to your customers.

These are the variables:

#TRACKINGNUMBER#This variable gets replaced with the tracking number associated.

#ZIP#This variable gets replaced with the receivers ("ship to") postcode.

#ORDERNUMBER#Order number belonging to the tracking number

#FIRSTNAME#(ship to) First name

#LASTNAME#(ship to) Last name

#COUNTRYCODE#(ship to) Country code in two letter format, e.g. "US"

#d#Shipment creation date - Day of month (e.g. 23)

#m#Shipment creation date - Month (e.g. 11)

#y#Shipment creation date - Year in two digit format

#Y#Shipment creation date - Year in four digit format


An example tracking URL for UPS would be: http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&WBPM_lid=homepage%2Fct1.html_pnl_trk&trackNums=#TRACKINGNUMBER#&track.x=Track


Many more tracking URLs for international carriers from >10 different countries can be found in the "TRACKING_URLS.txt" file that comes with the extension.

Developer Information

Adding tracking numbers via the API

When adding a tracking number via the Magento API, you need to specify a "carrier_code". For the custom trackers of our module, the carrier codes are "tracker1" through "tracker30". This means, if you want to add a tracking number for the carrier "XYZ" and set that up under "Custom Tracker - 3" in the admin, you'd need to send "tracker3" to the API.

Some third party applications such as Linnworks always send the tracking number with the carrier code "custom" to Magento. This is a problem, as in order to assign a custom tracker with a tracking link, it would need to send tracker1 to the API for example. This is not a problem in our extension but rather the third party application; of course it needs to send the correct carrier code to Magento in order for Magento to recognize "which" tracker should be used for the tracking number.

A possible workaround for applications that always send "custom" to Magento may be as following:

1) Set up a custom module & plugin for \Magento\Sales\Model\Order\Shipment\TrackRepository, method "save".
2) In the "around" plugin manipulate $entity so that "carrier_code" is set to "tracker1", for example, or whatever custom carrier code you want to set.

Attention, make sure to add a check that the request is coming from the API and/or some other criteria, otherwise all tracking numbers added & saved in Magento would be set using "tracker1".

Please note, again, this is not a problem in our extension and we cannot set up such a module for you nor customize Magento to fix this - either third party applications must send the correct carrier code OR you must set up a customization as described above.

Troubleshooting

The tracking link in the shipment email does not show up

Please make sure you have uploaded ALL extension files.

Please note that only NEW tracking numbers added using our *new* trackers will have links attached. This means, old shipments/tracking numbers, or shipments created using the default carriers built into Magento won't have links. If you want to set up links for UPS, USPS, DHL or FedEx, disable them using the "Disabled default carriers" option in the modules configuration and set them up as custom trackers with the links from the TRACKING_URLS.TXT file that comes with the extension.

Personal tools
Namespaces
Variants
Actions
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides
Toolbox