Articles on: Shopify

XML file format

For the XML file format:

First, choose the Upload File method.
Then, set the File Format to XML.
For the Parent and Variant nodes**,** refer below for more details.



The XML format can be pretty hard for some users to set up.

Here is a step-by-step instruction with an example for the parent node and variant node:

Add the Parent node, which is a mandatory field. Let's take the XML feed below as an example.

Based on the feed above, the Parent Node is <item>.
So, you need to type in the item in the field. There is no Variant Node present in the example above.

Please input Variant Node if a nested node is in the XML file.
The field mapping for XML will be straightforward. Based on the example above:

SKU = sku
Title = title
Description = description

Do no need to include the < > in the field mapping or node.


How to add a subnode?



If the XML file contains nodes like the below:

<product>
 <title>Pants</title>
 <description>Long Pants</description>
</product>


./product/title is the right way to write if it is a subnode.


Example 1



<item code="XYZ1001" description="Black Handlebar " instock="yes" wholesaleprice="100" rrp="150"/>


If the node is nested in this way, then you would need to map the variant node as the item. In field mapping, the code should be 

@code
@description
@instock


Example 2: Product and variants



<products>
 <product>
  <id>XYZ0001</id>
  <title>Pants</title>
      <brand>
          <id>21</id>
          <title>New Collection</title>
     </brand>
 <variants>
  <variant>
  <id>31950</id>
  <type>S</type>
  <title>Small</title>
  </variant>
 <variant>
<id>31951</id>
<type>M</type>
<title>Medium</title>
</variant>


In this case, the parent node is a product and the variant node is a variant.
The product id or title can be used as the variant group. 
To map the variant option, it will be ./title


Example 3



<description>
<long_desc xml:lang="eng"><style> </style> <br><br> <!-- tu zacystosowany do jednorazowej naprawy, przy długotrwałym użytkowaniu ulega zniszczeniu!</li></long_desc>
<long_desc xml:lang="fre"><style> </style> <br><br> <!-- tu z śrubokręt pentalobe do Apple iPhone 4</p> </long_desc>
<long_desc xml:lang="ita"><style> </style> <br><br> <!-- tu zaczyna sie naglowek w kolorze niebieskim <br><br><li>Åšrubiu!</li></long_desc>
<long_desc xml:lang="pol">Serwisowy śrubokręt Pentalobe do telefonu iPhone
</long_desc>
</description>

<price gross="0.11" net="0.09"/>
<srp gross="0" net="0"/>
<sizes>
<size code_producer="000000221006" code="169-uniw" weight="14">
<stock xmlns:iaiext="http://www.iai-shop.com/developers/iof/extensions.phtml" id="1" quantity="848" iaiext:location_id="545" iaiext:location_text_id="03-047-B"/>
<price gross="0.11" net="0.09"/>
<srp gross="0" net="0"/>
</size>
</sizes>


To map with the long_desc xml:lang="eng", you should map as this long_desc[@xml:lang=" eng”]
To map with the price gross, you should map as this .//*[name()= 'price']/@gross or price/@gross
To map with the price net, you should map as this .//*[name()= 'price']/@net or price/@net
To map with the weight, you should map as this @weight


Example 4



<products>
<product>
<id>XYZ0001</id>
    <title>Pants</title>
             <Category>New Collection</Category>
</product>


To map with the ID, you should map as the id
To map with the title, you should map as the title
For select Category, you can map as Category


Example 5



<ProductTitle>Kомплект в две части</ProductTitle>
<ProductType>Комплект</ProductType>
<Size>4XL</Size>
<Size>3XL</Size>
<Size>2XL</Size>
<Size>XL</Size>
<Size>L</Size>
<Size>M</Size>
<Size>S</Size>
<Sku>KL600/2</Sku>


When you want to map the size with the variant group, you can map it like this Size in the Variant group field. For example, for Variant option 1, you can map it with a dot, which is this "."


Example 6



<childproduct>
<product_ code>ABCD01</product_ref>
<product name>Lipstick Pink</product name>
<stock level>10</stock level>
<option 1>Matte</option 1>
<option_2>Shinny</option 2>
<picture>https://uk.kordabusiness.com/img/product_pictures/originals/32101611155422.jpg</pictures
</child product>

<childproduct>
<product_code>ABCD03</product_ref>
<product_name>Lipstick Blue</product_name>
<stock level>230</stock level>
<option_1>Mattee</option 1>
<option 2>Shinny</option 2>
<picture>https://uk.kordabusiness.com/img/product_pictures/originals/18671611155419.jpg</picture>
</child product>


According to the above XML file, if you want to map the image of each variant, you can map it as this "./picture" in the image field. So, it will take a different image for each variant. 


Example 7



<childproduct>
<param name="Dužina, mm">194</param>
<param name="Težina, g">46</param>
<param name="Garancija">15 godina</param>
<param name="Zemlja porekla">Nemačka</param>
<param name="Dužina ručke (mm)">94</param>
<param name="Veličina slota">4,0</param>
<param name="Širina slota">0,8</param>
<param name="Dužina oštrice (mm)">100</param>
<param name="EAN">4007157531414</param>
</child product>


According to the above XML file, if you want to map the EAN of the product, you can map it as this *[@name="EAN"] to get the EAN value. 


Example 8



<a name="34" option_id="1287" nr_cat="8394" ean="4673884832"> <[CDATA[0]]></a>
<a name="33" option_id="3562" nr_cat="3445" ean="2344567777"> <[CDATA[20]]></a>
<a name="32" option_id="3462" nr_cat="1223" ean="2345689233"> <[CDATA[30]]></a>


According to the above XML file, if you want to map the node of EAN, you can map it as this @ean to get the EAN value. Since the value of CDATA is the same element, it can just be used . to get the value of CDATA - 0, 20, 30.


Example 9



<offer xmlns="http://www.iai-shop.com/developers/iof.phtml">
<products>
<product xmlns:iaiext="http://www.iai-shop.com/developers/iof/extensions.phtml" xmlns="http://www.iai-shop.com/developers/iof.phtml" id="411" currency="EUR" code_on_card="304004" producer_code_standard="OTHER" type="regular" vat="23.0" site="1">
<srp gross="16.35" net="13.3"/>
  <sizes iaiext:group_name="Grupa rozmiaru uniwersalnego" iaiext:group_id="-1" iaiext:sizeList="full">
    <size id="uniw" name="universal" panel_name="uniw" code="411-uniw" weight="300" iaiext:weight_net="210" code_producer="304004" iaiext:code_external="Tool: eject level 1000pcs/bag" iaiext:priority="0">
      <price gross="16.35" net="13.3"/>
      <srp gross="16.35" net="13.3"/>
      <stock id="1" quantity="88" available_stock_quantity="88" stock_quantity="89.000" location_id="269" location_text_id="01-001-D"/>
    </size>
  </sizes>


If you have mapped your XML properly but it's still not working, make sure to check if the xmlns line is provided and include it in the mapping if it is present ./xmlns:sizes/xmlns:size/xmlns:stock/@quantity


Example 10



<sizes>
<size code="27-0" code_producer="_RAGABAUF013" id="0" weight="10100">
<stock id="0" quantity="-1"/>
<stock id"1" quantity="3"/>
</size>
</sizes>


According to the above XML file, if you want to map the quantity value of node id [0], you can map it as this ./sizes/size/stock[@id='0']/@quantity

Updated on: 29/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!