Setup guide

How to run a query with Shopify CLI (shopify store execute)

Shopify CLI runs the same queries as the GraphiQL app, but from your computer’s terminal, and it can save every answer to a file. Install Node.js 22.12 or newer, run npm install -g @shopify/cli@latest, sign in once with shopify store auth, then run the shopify store execute command a tool gives you.

Commands and flags checked against Shopify’s CLI reference on shopify.dev on 28 November 2026.

When to use it

You never need the CLI: every tool also works with the GraphiQL app. Use the CLI when a tool says a job has many batches, because it runs them one after another and saves the answers to a file you paste back.

Install it (once)

  1. Install Node.js. Download Node.js 22.12 or newer from nodejs.org and install it. Shopify CLI also needs Git 2.28 or newer.

  2. Open a terminal. On a Mac, open Terminal. On Windows, open PowerShell.

  3. Install Shopify CLI. Paste this command and press Enter.

    npm install -g @shopify/cli@latest
  4. Check it worked. Run shopify version. You should see a version number.

    shopify version

Sign in to your store (once per store)

  1. Run store auth. Replace the store address with yours and the scopes with the ones the tool lists, separated by commas. A browser window asks you to approve.

    shopify store auth --store your-store.myshopify.com --scopes read_products,write_products

Run a query or a change

  1. Save the files. Save the tool’s query as query.graphql and its variables (if any) as variables.json in the folder your terminal is in. Many tools give you a ready-made script that does this for you.

  2. Run the command. Changes are switched off unless you add --allow-mutations, so a read can never change your store by accident.

    shopify store execute --store your-store.myshopify.com \
      --query-file query.graphql --variable-file variables.json \
      --allow-mutations --json --output-file result.json
  3. Paste the answer back. Open result.json, copy everything, and paste it into the tool’s results step.

Tools that need this

More setup guides

Sources

Updated .