Skip to content

Shopify Order Cancellation XML (GraphQL)

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

We recommend that the ZynkExternalId field be populated with the unique ID of the cancellation from the external system. Zynk uses this field to track cancellations already processed, to prevent the same cancellation being sent to Shopify more than once. 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"?>
<OrderCancellations>
  <OrderCancellation>
    <ZynkExternalId>5230</ZynkExternalId>
    <NotifyCustomer>false</NotifyCustomer>
    <Order>
      <Id>gid://shopify/Order/6022747717721</Id>
      <Name>#1116</Name>
    </Order>
    <Reason>CUSTOMER</Reason>
    <Refund>true</Refund>
    <Restock>true</Restock>
    <StaffNote>Customer changed their mind</StaffNote>
  </OrderCancellation>
</OrderCancellations>

Order Cancellation

The following information can be provided for each cancellation. Cancellations are processed asynchronously by Shopify, so a record appearing in the success file means Shopify has accepted the cancellation request.

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
orderId Order/Id string Dependant Required if Order/Name is not provided. Must be a GraphQL ID, e.g. gid://shopify/Order/123
orderId Order/Name string Dependant Required if Order/Id is not provided, e.g. #1001. Only used to look up the order when Order/Id is empty
reason Reason enum Required One of CUSTOMER, DECLINED, FRAUD, INVENTORY, OTHER, STAFF
refund Refund bool Required Whether to refund the amount paid by the customer
restock Restock bool Required Whether to restock the inventory committed to the order
notifyCustomer NotifyCustomer bool Optional Whether Shopify sends a cancellation email to the customer
staffNote StaffNote string Optional A note about the cancellation, only visible to staff

The record will fail without being sent to Shopify if the Order element is missing, or if any of Reason, Refund or Restock are not provided.

<?xml version="1.0" encoding="utf-8"?>
<OrderCancellations>
  <OrderCancellation>
    <ZynkExternalId>5230</ZynkExternalId>
    <NotifyCustomer>false</NotifyCustomer>
    <Order>
      <Name>#1116</Name>
    </Order>
    <Reason>CUSTOMER</Reason>
    <Refund>true</Refund>
    <Restock>true</Restock>
    <StaffNote>Customer changed their mind</StaffNote>
  </OrderCancellation>
</OrderCancellations>