Automatically Export Your Shopify Multi-Location Inventory Data to CSV With EZ Exporter

We've recently pushed an update to EZ Exporter to provide an option to include inventory levels from multiple Shopify locations as part of the product data export.

When you go to the Data Settings in EZ Exporter, you'll now see the following new fields:

  • variants.inventory_levels
  • variants.inventory_levels.available
  • variants.inventory_levels.location_id
  • variants.inventory_levels.location_name
  • variants.inventory_levels.updated_at

By default, the fields that start with variants.inventory_levels. such as variants.inventory_levels.available will include the values from all locations separated by a comma. To split them up in separate columns in the CSV file, you can use our Calculated Fields feature with the search_attributes() function. This allows you to pick just the inventory levels from specific locations as well.

Here's an example formula to extract the inventory quantity from a Shopify location named "Warehouse 001":

search_attributes({{ variants.inventory_levels }}, "Warehouse 001", search_key="location_name", result_key="available")

The formula above searches the content of the variants.inventory_levels fields, which is in raw JSON format as provided by the Shopify API. It will search the attribute called "location_name" for the keyword "Warehouse 001" and returns the value of the "available" attribute in a column in the CSV export.

Another way we can search for the data is by the location_id attribute, which we recommend. The reason it's a good idea to use the location_id instead of the location_name is because the location_name can be modified in the Shopify Admin at any time. If you change the name of the location, you will then have to update your formula.

While Shopify doesn't display the location_id in the Shopify Admin directly, you can retrieve this value by looking at the URL as shown below:

Shopify Admin - Location ID in URL

Now that we have the location_id, we can use it in the formula like this:

search_attributes({{ variants.inventory_levels }}, 9390588019, search_key="location_id", result_key="available")

You can repeat this formula for all the locations you'd like included in the report as shown below:

EZ Exporter - Custom CSV - Shopify Inventory by Location Report

And the output will look something like this:

EZ Exporter - Shopify Inventory Report by Location - Custom CSV

As you can see in the screenshot, the individual inventory quantity from each of the location we specified in the Calculated Fields are now placed in their own separate columns.

You can do further customization here for different use cases as well. Here's a few examples:

  • Create a separate CSV export of each location to be sent to another company.
  • Only export quantities from specific locations.
  • Perform arithmetic operations using values from one or more locations.
  • Perform conditional logic referencing one or more locations. For example, if you need to send a CSV feed to another company who don't use actual numbers for inventory levels, you can do a conditional logic for something like "if the quantity is 0 use the value 'Out of Stock', else if it's greater than 100, use the value 'High'."

We understand that using the formulas can get a little complex, so please don't hesitate to reach out to us if you need any assistance or have any questions!

Tags: new features, shopify, ez exporter, inventory, ecommerce, multi-location inventory