Update inventory from an XML feed

Stockeo can sync the inventory in your Shopify store with your supplier's XML feed.

Create an automation in Stockeo

Let's start by adding a new Stockeo automation. Navigate to your Shopify admin panelAppsStockeo. Hit Create Automation. Type the automation name (or leave the default one), select whether to create or update (this option in our case) products and set when the automation should run.

In the next step, set where to get the product feed from. Select one of the available channels - HTTP, FTP, or Email. If you are going to use FTP, fill in the Host URL, Username, Password, and File path fields. Once you finished, click Connect.

Let's move to the Data Mapping section. Start by choosing the file format. Specify the Product Element, i.e. the name of the XML element that wraps product details. Set the SKU and Quantity fields according to the names used in the file from your supplier. You can also add other fields that you would like to update such as Barcode, Compare at Price, Cost Per Item, Price, Title or Weight.

Set the filters to choose which products should be modified. You can filter by vendor or product tags. Pick also the location for which the quantity will be updated. Finally, save the automation.

Run your automation

To see how it works, wait for a scheduled action or click Run to update products right away. Then navigate to the Stockeo History section. If you can see 'In progress', please refresh the page. The update time depends on the feed size and the number of products in your store. When the status is 'Success', you can click on Details to check how many and which products have been modified.

Advanced XML data mapping

To navigate through elements and attributes in an XML document Stockeo relies on XPath. You can use the XPath expressions to pull data from a node's attribute or to extract data from a node containing a specific attribute with a specific value.

Extract data from an attribute

It can be that the data you want to extract from an XML and use them for creating/updating products are stored as XML attributes.

<product id="3378" currency="EUR" code_on_card="01269" producer_code_standard="OTHER" type="regular" vat="23.0" site="7">
    <name xml:lang="eng"><![CDATA[Wooden Clock With Nickel Details]]></name>
    <name xml:lang="hun"><![CDATA[Fa óra nikkel részletekkel]]></name>
    <name xml:lang="pol"><![CDATA[Drewniany zegar z niklowymi dodatkami]]></name>
  <stock quantity="443" available_stock_quantity="443" stock_quantity="443.000"/>
      <image iaiext:priority="1" url="https://www.hill-interiors.com/images/giant/19184.jpg" width="750" height="562"/>
      <image iaiext:priority="2" url="https://www.hill-interiors.com/images/giant/19185.jpg" width="750" height="562"/>
      <icon url="https://www.hill-interiors.com/images/19186.jpg" 15:25:09" width="400" height="299"/>

In the above example, the node with all information about a product is <product>.

The path to the nodes nested within it is relative. To get the id value which is the attribute of the product node, type the @ sign and attribute name.

To extract an attribute value from a node nested within <product>, enter the child node name, slash, @ sign and attribute name.

Select the node with the specific attribute

It may also happen you want to select a node with a specific attribute from which you need to extract data. Assume you would like to extract the product title from the name node containing the xml:lang="eng" attribute. In this case, provide the node name, and in the square bracket type the @ sign followed by the name of the attribute with its value. For our example XML it looks like this:

Another example illustrates a combination of both: selecting a node with a specific attribute value and extracting data from the attribute to pull all product images from the feed.

Last updated