Exporting Inventory Transfers In Shopify
Using Shopify’s inventory management is usually super easy and allows for neat things like showing you customers when an out of stock item is due to come back in. However the admin area is lacking some features merchants need and sadly there isn’t an official API endpoint currently.
A client wanted to be able to export a transfer as a CSV along with a metafield they use to store Bin Locations for products. So they can check a delivery then store those items in the right places easily, so…
It was time to get creative/hacky with a solution.
Many of the pages in the Shopify admin are available as JSON, simply by adding .json to the end of a URL.
For Transfers this gives us the basic info about a transfer and a “line_items” array, however this array only contains the product and variant IDs along with quantity info, so no product/variant titles or metafields.
So we can’t just export that and hit print. But we could iterate over that array and fetch the info we needed for each product from the other Shopify REST APIs, hmmm.
Chrome Extension enters the chat
With a Chrome extension we can fetch the .json version of a page then iterate over the line_items array and fetching additional data from Shopify API endpoints. Add them to the original Transfer info, then convert that to a CSV file.
It’s not perfect, however might act as a jumping off point for other Shopify developers to build their own, or maybe inspire devs at Shopify to add an export function to the “More Actions” menu you can see in the GIF above.
Disclaimer - this uses undocumented Shopify endpoints, so it might stop working if they change these