Skip to content

Shopify Publication XML (GraphQL)

Important

This task is only available for Shopify Plus.

The XML format documented here is used for the import of publications into Shopify, via the Import Publications task. A publication controls which products are available in a catalog.

The ZynkExternalId field can be populated with a unique ID for the publication from the external system. Zynk uses this field in conjunction with the 'Prevent Reprocessing' setting, which is disabled by default on this task. If no existing publication is found and the ZynkExternalId has been processed before, the publication ID stored by Zynk is used.

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"?>
<Publications>
  <Publication>
    <ZynkExternalId>ACME-CATALOG</ZynkExternalId>
    <AutoPublish>false</AutoPublish>
    <DefaultState>EMPTY</DefaultState>
    <Catalog>
      <Title>ACME Ltd</Title>
    </Catalog>
    <Products>
      <Record>
        <Id>gid://shopify/Product/7915652743257</Id>
      </Record>
      <Record>
        <Sku>TSHIRT-S-RED</Sku>
      </Record>
    </Products>
  </Publication>
</Publications>

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

Publication

The publication is identified by Id, otherwise it is looked up from the catalog given by Catalog/Id or Catalog/Title. If the catalog has no publication, a new publication is created for the catalog. If Catalog/Title doesn't match a catalog, a new publication is created without one, so check the title carefully.

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 GraphQL ID of an existing publication, e.g. gid://shopify/Publication/123. Required if Catalog/Id and Catalog/Title are not provided
catalogId Catalog/Id string Dependant Required if Id and Catalog/Title are not provided, e.g. gid://shopify/CompanyLocationCatalog/123
- Catalog/Title string Dependant Required if Id and Catalog/Id are not provided. Fails if more than one catalog matches
autoPublish AutoPublish bool Optional Whether new products are automatically published to the publication. Applied on create and update
defaultState DefaultState enum Optional EMPTY or ALL_PRODUCTS. Only used when creating a publication. ALL_PRODUCTS cannot be combined with Products
<?xml version="1.0" encoding="utf-8"?>
<Publications>
  <Publication>
    <ZynkExternalId>ACME-CATALOG</ZynkExternalId>
    <AutoPublish>false</AutoPublish>
    <DefaultState>EMPTY</DefaultState>
    <Catalog>
      <Id>gid://shopify/CompanyLocationCatalog/40769585241</Id>
    </Catalog>
  </Publication>
</Publications>

Products

The products to add to the publication. Products are only ever added; any products already in the publication but not in the XML are left in place.

Each product must have an Id or a Sku. A Sku is matched against product variants, and every product with a variant using that SKU is added. The record fails if no product is found for a SKU.

Shopify Field XML Field Type Input Notes
publishablesToAdd Id string Dependant Required if Sku is not provided, e.g. gid://shopify/Product/123
- Sku string Dependant Required if Id is not provided
<?xml version="1.0" encoding="utf-8"?>
<Publications>
  <Publication>
    <Products>
      <Record>
        <Id>gid://shopify/Product/7915652743257</Id>
      </Record>
      <Record>
        <Sku>TSHIRT-S-RED</Sku>
      </Record>
    </Products>
  </Publication>
</Publications>