How do I export the inventory quantity from each Shopify location?
EZ Exporter can export each variant's 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 A".
search_attributes(search_attributes({{ variants.inventory_levels }}, "Warehouse A", search_key="location_name", result_key="quantities"), "available", search_key="name", result_key="quantity")
The formula above searches the attribute called "location_name" for the keyword "Warehouse A" and returns the quantity value for the "available" inventory state.
The formula is a bit complex, but the main things to note here are the parts where it says "Warehouse A" (the location name) and "available" (the inventory state). You can basically copy/paste this formula and change the location name and inventory state value to extract the quantity from a specific location for a specific inventory state.
Sample output:
Below is a list of valid inventory states:
- available
- incoming
- committed
- on_hand
- reserved
- damaged
- safety_stock
- quality_control
The last 4 states above make up the "unavailable" state.
If you need to export the "unavailable" quantity from a specific location, you can use this formula below which is a little more complicated (make sure to replace "Warehouse A" with the location name from your store):
get_total([q.quantity for q in load_json_data(search_attributes({{ variants.inventory_levels }}, "Warehouse A", search_key="location_name", result_key="quantities")) if q.name in ["damaged", "quality_control", "reserved", "safety_stock"]])
If you're having trouble getting this to work, please don't hesitate to contact us!
App: EZ Exporter