In Shopify CLI 3.90.1, we released two new Shopify CLI commands that improve your experience exploring and automating the GraphQL Admin API: shopify app execute, for running queries and mutations, and shopify app bulk execute, for running bulk queries and bulk mutations. These come on the heels of the release of improved performance and expanded mutation support for bulk operations, which make it possible to handle larger data sets for a wider variety of data types. With this Shopify CLI release, itβs now easy for app developers to script and automate both bulk operations and standard GraphQL operations with the Admin API, right in your terminal.
Iβve been exploring some use cases for these commands in a sample application that Iβm sharing with the community. Itβs no surprise that pairing these commands with agentic tools like Claude Code and the Shopify Dev MCP server is extremely powerful. You can quickly create scripts that interact with store data in a variety of ways. Command line utilities like jq can be used directly against the output of these commands to extract, manipulate, and combine data for customized output, or for piping into another command.
Letβs take a look at the examples found within.
Hello, world!
Start simple. Sometimes you just want to get a piece of data, like the ID of the current shop.
shopify app execute --query '{ shop { id } }'
Coding agents with access to the Shopify Dev MCP server can craft accurate GraphQL queries for use with shopify app execute as well. Try prompts like:
- Query the current app ID
- How many products do I have in the current store?
- Whatβs the current active theme on this store?
Example:
Setting up test discounts for function development
When developing Shopify Functions, there is usually a required step to activate and configure the function before it will trigger on your store. If youβve yet to create an admin UI for your function, you might use GraphiQL to activate it with the Admin API. By scripting this instead, you can automate the setup and teardown of various function configurations, so that you can quickly verify them on your store.
Examples:
Even if you donβt need a persistent script for this, shopify app execute can be used by your coding agent to activate your function. Try prompts like:
- Use Shopify CLI to create a discount for the vip-discount.
- Use Shopify CLI to create a validation for New York and Massachusetts.
Opening a cart in checkout
Looking to test that function with a large cart, or a specific type of product? You can script the creation of a cart permalink with dynamic data from your store, and open it in your browser.
Example:
Exporting data to CSV
You know it, you love it: the CSV data dump. Sometimes they are still the only way to get data into legacy systems, and are definitely still useful for exploring data in spreadsheets. Bulk operations queries make it possible to export massive amounts of data without worrying about pagination or rate limits. By scripting them with shopify app bulk execute, you can pipe that data into tools like jq in order to obtain your desired format, like the flattened product/variant data in the example below.
Example:
Setting up a new development store
What if you could automate the setup of your entire store? Whether you are bringing a new teammate online, starting development of a new feature, or creating a testing environment β the ability to set up a clean, consistent store is invaluable. The new app dev command only reinforces this, since it encourages teams to use dev stores as the unit of isolation for team development.
Thereβs a lot that goes into store setup: creating and publishing products, setting inventory, uploading images, and more. However by combining bulk operations mutations with other GraphQL queries, you can go a long way in automating this for your team.
Examples:
Usage limitations
Keep in mind the following constraints on these commands:
- They authenticate as your app using client credentials, so they only have access to stores in your organization, and only to the access scopes that have been granted to your app.
- To prevent accidental damage to production data, especially when working with coding agents, Shopify CLI will only execute mutations against dev stores. You can still query non-dev stores in your organization, or write your own code with mutations against any authenticated store.
What else is possible?
We canβt wait to hear about how you plan to use these commands to automate your store environments and other routine development tasks. Please share your use cases in the comments, along with any other feedback you have on these new commands!