Skip to content

Shopify Order Update XML (GraphQL)

The XML format documented here is used to update existing orders in Shopify, via the Import Order Updates task.

The ZynkExternalId field can optionally be populated with a unique ID for the update from the external system. Zynk uses this field to track updates already processed when the 'Prevent Reprocessing' setting is enabled. The 'Prevent Reprocessing' setting is disabled by default on this task, as the same order will often be updated more than once.

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"?>
<Orders>
  <Order>
    <ZynkExternalId>SO-10523-1</ZynkExternalId>
    <Id>gid://shopify/Order/6026572595289</Id>
    <Name>#1117</Name>
    <CustomAttributes>
      <CustomAttribute>
        <Key>Colour</Key>
        <Value>Red</Value>
      </CustomAttribute>
    </CustomAttributes>
    <Email>[email protected]</Email>
    <Metafields>
      <Record>
        <Namespace>custom</Namespace>
        <Key>sage_order_no</Key>
        <Type>single_line_text_field</Type>
        <Value>0000000001</Value>
      </Record>
    </Metafields>
    <Note>Leave it behind the bin</Note>
    <Phone>0191 820 1484</Phone>
    <PoNumber>PO9999</PoNumber>
    <ShippingAddress>
      <Address1>Office 16</Address1>
      <Address2>6-8 Charlotte Square</Address2>
      <City>Newcastle upon Tyne</City>
      <Company>Zynk Software</Company>
      <CountryCodeV2>GB</CountryCodeV2>
      <FirstName>John</FirstName>
      <LastName>Smith</LastName>
      <Phone>0191 820 1484</Phone>
      <ProvinceCode>ENG</ProvinceCode>
      <Zip>NE1 4XF</Zip>
    </ShippingAddress>
    <Tags>
      <Tag>b2b</Tag>
    </Tags>
  </Order>
</Orders>

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 Orders schema is used above as a reference of where fields should be in the object model.

Order

The following information can be provided at the order level. Only the fields provided are sent to Shopify.

The order lines, fulfillments, refunds, shipping lines and tax lines can't be changed by this task. If a record contains any LineItems, Fulfillments, Refunds, ShippingLines or TaxLines, it will fail without being sent to Shopify.

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
id Id string Dependant Required if Name is not provided. Must be a GraphQL ID, e.g. gid://shopify/Order/123
name Name string Dependant Required if Id is not provided, e.g. #1001. Only used to look up the order when Id is empty
email Email string Optional The customer's email address on the order
note Note string Optional
phone Phone string Optional The customer's phone number on the order
poNumber PoNumber string Optional
tags Tags/Tag string Optional Overwrites the existing tags on the order
<?xml version="1.0" encoding="utf-8"?>
<Orders>
  <Order>
    <ZynkExternalId>SO-10523-1</ZynkExternalId>
    <Id>gid://shopify/Order/6026572595289</Id>
    <Name>#1117</Name>
    <Email>[email protected]</Email>
    <Note>Leave it behind the bin</Note>
    <Phone>0191 820 1484</Phone>
    <PoNumber>PO9999</PoNumber>
    <Tags>
      <Tag>b2b</Tag>
      <Tag>priority</Tag>
    </Tags>
  </Order>
</Orders>

Custom Attributes

The custom attributes (also known as note attributes) on the order. The attributes provided overwrite the existing custom attributes on the order.

Shopify Field XML Field Type Input Notes
customAttributes.key Key string Required
customAttributes.value Value string Required
<?xml version="1.0" encoding="utf-8"?>
<Orders>
  <Order>
    <CustomAttributes>
      <CustomAttribute>
        <Key>Colour</Key>
        <Value>Red</Value>
      </CustomAttribute>
    </CustomAttributes>
  </Order>
</Orders>

Metafields

Metafields to create or update on the order.

Shopify Field XML Field Type Input Notes
metafields.id Id string Optional GraphQL ID of an existing metafield, e.g. gid://shopify/Metafield/123
metafields.namespace Namespace string Dependant Required if Id is not provided
metafields.key Key string Dependant Required if Id is not provided
metafields.type Type string Optional The metafield type, e.g. single_line_text_field. Shopify requires this when creating a metafield that has no definition
metafields.value Value string Required
<?xml version="1.0" encoding="utf-8"?>
<Orders>
  <Order>
    <Metafields>
      <Record>
        <Namespace>custom</Namespace>
        <Key>sage_order_no</Key>
        <Type>single_line_text_field</Type>
        <Value>0000000001</Value>
      </Record>
    </Metafields>
  </Order>
</Orders>

Shipping Address

The shipping address of the order.

Shopify Field XML Field Type Input Notes
address1 Address1 string Optional
address2 Address2 string Optional
city City string Optional
company Company string Optional
countryCode CountryCodeV2 string Optional Two letter ISO country code, e.g. GB
firstName FirstName string Optional
lastName LastName string Optional
phone Phone string Optional
provinceCode ProvinceCode string Optional
zip Zip string Optional
<?xml version="1.0" encoding="utf-8"?>
<Orders>
  <Order>
    <ShippingAddress>
      <Address1>Office 16</Address1>
      <Address2>6-8 Charlotte Square</Address2>
      <City>Newcastle upon Tyne</City>
      <Company>Zynk Software</Company>
      <CountryCodeV2>GB</CountryCodeV2>
      <FirstName>John</FirstName>
      <LastName>Smith</LastName>
      <Phone>0191 820 1484</Phone>
      <ProvinceCode>ENG</ProvinceCode>
      <Zip>NE1 4XF</Zip>
    </ShippingAddress>
  </Order>
</Orders>