Update inventory from an XML feed
Stockeo can sync the inventory in your Shopify store with your supplier's XML feed.
Last updated
Stockeo can sync the inventory in your Shopify store with your supplier's XML feed.
Last updated
Let's start by adding a new Stockeo automation. Navigate to your Shopify admin panel → Apps → Stockeo. 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.
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.
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.
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.
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.
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.