I'm trying to add tracking to orders via the SOAP (V1) interface using the
sales_order_shipment.addTrack method - but as the title suggests I'm getting the following error:
Invalid carrier specified
The first thing I tried was to use the
custom carrier code as such:
'shipmentIncrementId' => $shipmentIncrementId, 'carrier' => 'custom', 'title' => 'My courier', 'trackNumber' => $tracking
(Note that both
$tracking are correct.)
This produced the aforementioned error.
So I decided to make my own module adding a custom carrier, I followed this tutorial. Most importantly, I've implemented
isTrackingAvailable() and made it return
Now, interestingly, if I make the call to
sales_order_shipment.getCarriers my custom carrier is there, so it should be available! However, when I again make the
sales_order_shipment.addTrack call with the following details:
'shipmentIncrementId' => $shipmentIncrementId, 'carrier' => 'name_of_module', 'title' => 'Custom Carrier', 'trackNumber' => $tracking
name_of_module is obviously the correct name of the module, returned by
getCarriers and this time I've matched the title to the one defined in the module (
With this, I still get the same error of
Invalid carrier specified! Surely if
getCarriers returns this carrier for an order it shouldn't be invalid?
The only place on the web that attempts to document this error is here, as described above I have followed the suggested steps according to that link.
Could anyone point me to where I'm going wrong? Thanks in advance for your help.
P.S. If it makes any difference, I'm trying to avoid adding a new module for every single carrier we use, I'd like to be able to pass through the correct title of the carrier through SOAP and add any tracking number (we don't use any of the predefined carriers in Magento).
The following is the code that calls the API:
$this->magentoAPI->request( 'sales_order_shipment.addTrack', [ 'shipmentIncrementId' => $shipmentIncrementId, 'carrier' => 'fesp_fixstupidcarriers', 'title' => 'Custom Carrier', 'trackNumber' => $tracking, ] );
This uses my custom function, which in turn runs
call_user_func_array([$client, 'call'], $arguments);
$arguments comes out as the following array:
[ 'whatever-the-session-id-is', 'sales_order_shipment.addTrack', '100002290', 'fesp_fixstupidcarriers', 'Custom Carrier', '9348278247008183' ];
I'm showing actual data this time, that's a real
shipmentIncrementId, the actual carrier code, and the real tracking number.
This function works for all other calls of the API I've tried (about a dozen).