Stockeo Help
Ask or search…
K

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.
How to create new automation in Stockeo app for Shopify animated
Create new Stockeo automation
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.
How to set up feed source in the Stockeo app for Shopify animated
Set the feed source
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.
How to set Data Mapping in the Stockeo app for Shopify animated
Set the Data Mapping
Fields from the supplier's file needed in Stockeo data mapping section annotated
Fields from your supplier's feed needed in the Stockeo Data Mapping section
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.
How to set filters and location in the Stockeo automation animated
Set filters and location

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.
Run automation and check a summary

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">
<names>
<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>
</names>
<stock quantity="443" available_stock_quantity="443" stock_quantity="443.000"/>
<images>
<large>
<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"/>
</large>
<icons>
<icon url="https://www.hill-interiors.com/images/19186.jpg" 15:25:09" width="400" height="299"/>
</icons>
</images>
</product>
In the above example, the node with all information about a product is <product>.
Stockeo Product Element in the XML automation annotated
Stockeo Product Element in the XML automation
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.
Stockeo setting
Copy this setting
Use the id attribute of product node in the Stockeo automation
Use the id attribute of the product node in the Stockeo automation
@id
To extract an attribute value from a node nested within <product>, enter the child node name, slash, @ sign and attribute name.
Stockeo setting
Copy this setting
Use the attribute of the stock node in the Stockeo automation
stock/@available_stock_quantity

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:
Stockeo setting
Copy this setting
Select node with a specifi attribute in the Stockeo automation annotated
Select node with a specifi attribute in the Stockeo automation
names/name[@xml:lang='eng']
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.
Stockeo setting
Copy this setting
Pull data from attribute of a node with specific other attribute in Stockeo automation annotated
Pull data from attribute of a node with specific other attribute in Stockeo automation
images/large/image[@iaiext:priority="1"]/@url
images/large/image[@iaiext:priority="2"]/@url