How do I export the inventory quantity from each Shopify location?

If you have Shopify's multi-location feature enabled, EZ Exporter can export each variant's available quantity from each location and place them in separate columns using Calculated Fields.

To do so, we need to use the search_attributes() function with the variants.inventory_levels field that contains the inventory level data for all locations.

Here's an example where we search the data for the available quantity from the location named "Warehouse 001".

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

The formula above searches the attribute called "location_name" for the keyword "Warehouse 001" and returns the value of the "available" attribute.

Another way to 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 (note that in this case the value of the location_id is not enclosed with quotes as it's an integer-type data):

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:

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

If you're having trouble getting this to work, please don't hesitate to contact us!


App: EZ Exporter

Tags: advanced features, inventory, multi-location inventory