Skip to content

Magento V2 Tracking XML

The XML format documented here is used to add tracking information to an existing shipment in Magento, via the Import Tracking to Magento V2 task.

To create the shipment and its tracking in one go, send the tracking in the tracks collection of a shipment instead, see Magento V2 Shipment XML.

Sample XML

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfTracking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Tracking>
    <external_id>000165476-123</external_id>
    <shipment>
      <increment_id>000165476</increment_id>
    </shipment>
    <order>
      <increment_id>000203077</increment_id>
    </order>
    <qty>1</qty>
    <weight>0</weight>
    <track_number>123</track_number>
    <title>DHL</title>
    <carrier_code>dhl</carrier_code>
    <description>Next day delivery</description>
  </Tracking>
</ArrayOfTracking>

Tracking

Magento Field XML Field Type Input Notes
Shipment shipment/increment_id* string Conditional The Magento shipment number to add the tracking to
Shipment shipment/entity_id* int Conditional The Magento entity ID of the shipment
Shipment parent_id* int Conditional As shipment/entity_id, at the top level of the tracking
Order order/increment_id* string Conditional The Magento order number the shipment belongs to
Order order/entity_id* int Conditional The Magento entity ID of the order
Order order/external_id* string Conditional The external_id the order was exported with. Zynk looks the order up in its internal DB
Order order_id* int Conditional As order/entity_id, at the top level of the tracking
Number track_number string Required The tracking number from the carrier
Title title string Required The description shown to the customer, e.g. DHL Next Day Shipping
Carrier carrier_code string Required The Magento carrier code, e.g. dhl, fedex, ups, or custom
- description string Optional Where this is not supplied, the value of the Description setting on the task is used
- qty decimal Optional The quantity covered by this tracking number
- weight decimal Optional The weight covered by this tracking number
- created_at DateTime Optional
- updated_at DateTime Optional
  • shipment/increment_id*, shipment/entity_id*, parent_id* - One of these is required to identify the shipment the tracking is added to
  • order/increment_id*, order/entity_id*, order/external_id*, order_id* - One of these is required to identify the order the shipment belongs to

Common Fields

The following fields are supported on every record we import into Magento. They are used by Zynk rather than sent to Magento.

XML Field Type Input Notes
external_id string Optional The unique ID of the record in the external system. Stored in Zynk's internal DB and used to track records already imported. Required when the Prevent Reprocessing setting is enabled on the task
store_code string Optional The store view code to send this record to, overriding the Store View Code setting on the task for this record only
match element Optional Match an existing record on a field and value other than the default. See Matching Records in Magento v2
matches element Optional As match, but matching on more than one field. See Matching Records in Magento v2

Errors

Records which fail to import are written to the Fail File in the same format as the input file, with the reason for the failure added in an errors element. There is no need to send this element yourself.

The name of each error tells you at which stage the record failed:

Name Meaning
Pre-Validation Zynk checked the record before sending it and found a problem, e.g. a required field is missing or a related record could not be found. The record was not sent to Magento
Prevent Reprocessing A record with the same external_id has already been imported, and the Prevent Reprocessing setting is enabled on the task
Error Magento rejected the record, or Zynk could not match the record to the data already in Magento. The description contains the message returned by Magento
Upload Error An unexpected error occurred while sending the record to Magento
<Tracking>
  <shipment>
    <increment_id>000000003</increment_id>
  </shipment>
  <errors>
    <error>
      <name>Error</name>
      <description>The shipment with increment_id = 000000003 does not exist in Magento.</description>
    </error>
  </errors>
</Tracking>