Skip to content

Shopify Fulfillment XML (GraphQL)

The XML format documented here is used for the import of fulfillments into Shopify, via the Import Fulfillments task.

We recommend that the ZynkExternalId field be populated with the unique ID of the fulfillment from the external system. Zynk uses this field to track fulfillments already imported, to prevent duplicates being created in Shopify. The 'Prevent Reprocessing' setting is enabled by default on this task.

XML

Any fields not documented below are ignored by the task. Examples of where in the XML the fields should appear are shown in the samples below.

<?xml version="1.0" encoding="utf-8"?>
<Fulfillments>
  <Fulfillment>
    <ZynkExternalId>DESP-10523</ZynkExternalId>
    <NotifyCustomer>false</NotifyCustomer>
    <Order>
      <Id>gid://shopify/Order/6022747717721</Id>
      <Name>#1116</Name>
    </Order>
    <Location>
      <Id>gid://shopify/Location/16144367705</Id>
      <Name>Newcastle</Name>
    </Location>
    <OriginAddress>
      <Address1>Unit 4</Address1>
      <Address2>Riverside Park</Address2>
      <City>Newcastle</City>
      <ProvinceCode>TWR</ProvinceCode>
      <Zip>NE1 1AA</Zip>
      <CountryCode>GB</CountryCode>
    </OriginAddress>
    <TrackingInfos>
      <TrackingInfo>
        <Company>DPD</Company>
        <Number>1239471491735</Number>
        <Url>https://dpd.com/track?id=1239471491735</Url>
      </TrackingInfo>
    </TrackingInfos>
    <FulfillmentLineItems>
      <Record>
        <LineItem>
          <Sku>TFD0121</Sku>
        </LineItem>
        <Quantity>2</Quantity>
      </Record>
    </FulfillmentLineItems>
  </Fulfillment>
</Fulfillments>

In each of the following sections most of the XML has been omitted to make the samples easier to read. The whole structure of the Fulfillments schema is used above as a reference of where fields should be in the object model.

Fulfillment

The following information can be provided at the fulfillment header level.

Shopify Field XML Field Type Input Notes
- ZynkExternalId string Optional Stored in Zynk's internal DB and used in conjunction with the 'Prevent Reprocessing' setting
notifyCustomer NotifyCustomer bool Optional Whether Shopify sends a shipping confirmation email to the customer
Order Order/Id string Dependant Required if Order/Name is not provided. Accepts a GraphQL ID (gid://shopify/Order/123) or the numeric order ID
Order Order/Name string Dependant Required if Order/Id is not provided, e.g. #1001
Location Location/Id string Dependant Required if Location/Name is not provided. Must be a GraphQL ID (gid://shopify/Location/123)
Location Location/Name string Dependant Required if Location/Id is not provided

The order must have at least one fulfillment order assigned to the given location which allows fulfillments to be created, otherwise the record will fail.

<?xml version="1.0" encoding="utf-8"?>
<Fulfillments>
  <Fulfillment>
    <ZynkExternalId>DESP-10523</ZynkExternalId>
    <NotifyCustomer>false</NotifyCustomer>
    <Order>
      <Id>gid://shopify/Order/6022747717721</Id>
      <Name>#1116</Name>
    </Order>
    <Location>
      <Id>gid://shopify/Location/16144367705</Id>
      <Name>Newcastle</Name>
    </Location>
  </Fulfillment>
</Fulfillments>

Origin Address

The address the fulfillment was shipped from. All fields are optional.

Shopify Field XML Field Type Input Notes
address1 Address1 string Optional
address2 Address2 string Optional
city City string Optional
provinceCode ProvinceCode string Optional
zip Zip string Optional
countryCode CountryCode string Optional Two letter ISO country code, e.g. GB
<?xml version="1.0" encoding="utf-8"?>
<Fulfillments>
  <Fulfillment>
    <OriginAddress>
      <Address1>Unit 4</Address1>
      <Address2>Riverside Park</Address2>
      <City>Newcastle</City>
      <ProvinceCode>TWR</ProvinceCode>
      <Zip>NE1 1AA</Zip>
      <CountryCode>GB</CountryCode>
    </OriginAddress>
  </Fulfillment>
</Fulfillments>

Tracking Info

Multiple TrackingInfo elements can be provided to add several tracking numbers to the fulfillment.

Shopify Field XML Field Type Input Notes
trackingInfo.company Company string Optional Shopify only stores one carrier per fulfillment, so the company from the first TrackingInfo is used
trackingInfo.numbers Number string Optional
trackingInfo.urls Url string Optional
<?xml version="1.0" encoding="utf-8"?>
<Fulfillments>
  <Fulfillment>
    <TrackingInfos>
      <TrackingInfo>
        <Company>DPD</Company>
        <Number>1239471491735</Number>
        <Url>https://dpd.com/track?id=1239471491735</Url>
      </TrackingInfo>
      <TrackingInfo>
        <Company>DPD</Company>
        <Number>1239471491736</Number>
        <Url>https://dpd.com/track?id=1239471491736</Url>
      </TrackingInfo>
    </TrackingInfos>
  </Fulfillment>
</Fulfillments>

Fulfillment Line Items

If no line items are provided, all remaining items on the fulfillment orders for the given location will be fulfilled.

Each line must be matched to an order line using one of Id, LineItem/Id or LineItem/Sku, in that order of precedence. When matching by LineItem/Id or LineItem/Sku, the quantity is allocated across the matching fulfillment order lines with a remaining quantity. Multiple lines for the same SKU are combined.

Shopify Field XML Field Type Input Notes
FulfillmentOrderLineItem.id Id string Dependant Fulfillment order line item ID, e.g. gid://shopify/FulfillmentOrderLineItem/123. Required if LineItem/Id and LineItem/Sku are not provided
LineItem.id LineItem/Id string Dependant Order line item ID, e.g. gid://shopify/LineItem/123. Required if Id and LineItem/Sku are not provided
LineItem.sku LineItem/Sku string Dependant Order line item SKU. Required if Id and LineItem/Id are not provided
quantity Quantity int Required Cannot exceed the quantity remaining to be fulfilled
<?xml version="1.0" encoding="utf-8"?>
<Fulfillments>
  <Fulfillment>
    <FulfillmentLineItems>
      <Record>
        <Id>gid://shopify/FulfillmentOrderLineItem/14792489599065</Id>
        <Quantity>1</Quantity>
      </Record>
      <Record>
        <LineItem>
          <Id>gid://shopify/LineItem/14582187720793</Id>
        </LineItem>
        <Quantity>1</Quantity>
      </Record>
      <Record>
        <LineItem>
          <Sku>TFD0121</Sku>
        </LineItem>
        <Quantity>2</Quantity>
      </Record>
    </FulfillmentLineItems>
  </Fulfillment>
</Fulfillments>