Skip to content

Instantly share code, notes, and snippets.

@sshaw
Last active April 1, 2026 23:37
Show Gist options
  • Select an option

  • Save sshaw/dea140dd7a6afc1a4de77e7158605ee7 to your computer and use it in GitHub Desktop.

Select an option

Save sshaw/dea140dd7a6afc1a4de77e7158605ee7 to your computer and use it in GitHub Desktop.
Export the metafields of all products in your Shopify store to a JSONL file using Shopify Development Tools (https://github.com/ScreenStaring/shopify-dev-tools)
#!/bin/bash
#
# Export the metafields for products in your Shopify store to a JSONL file.
# Can be modified to output to a file per product or to text file(s).
# See Shopify Development Tools (sdt) for more infomation.
#
# By ScreenStaring (http://screenstaring.com)
#
#
# This script requires Shopify Development Tools: https://github.com/ScreenStaring/shopify-dev-tools
#
export SHOPIFY_SHOP=your-store
# Add your credentials here. For more information see: https://github.com/ScreenStaring/shopify-dev-tools#credentials
export SHOPIFY_API_TOKEN=your-token
# Note the sdt will exit 0 on usage (cli lib bug)
set -e
sdt products export ids
for id in $(cut -f1 -d, "$SHOPIFY_SHOP.csv" | egrep '^[0-9]+$'); do
echo "Retrieving metafields for product $id"
# Requires v0.0.3 or greater
sdt metafield product -j "$id" >> product-metafields.jsonl
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment