Shopify CLI extension commands

This page lists Shopify CLI commands for creating, registering, and pushing app extensions.

shopify extension create [options]

Use the shopify extension create command to scaffold a new extension project in a subdirectory of your app. To specify the type and name of your extension, you can use the interactive prompts or the command options.

Create an extension using interactive prompts

To create an extension, run shopify extension create and select an extension type from the list of options in the prompt.

Available options

  • --type: The type of extension that you want to create.

  • --name: The name of the extension (50 character limit). Shopify CLI transforms the input into lowercase and snake case to name your directory.

shopify extension serve

In your extension’s directory, you can run shopify extension serve to start a local server that can be rendered in the development store. The server will continue to run until you press Ctrl-C.

Available options

  • --tunnel: Creates an HTTP tunnel (this is the default behavior).

  • --no-tunnel: Skips creating an HTTP tunnel.

  • --resourceUrl: A relative link to product or variant. To test with a specific product ID, you can provide the flag as follows: shopify extension serve --resourceUrl="products/12345", where 12345 is the product ID. To test with a specific product variant ID, you can provide the variant in this way: shopify extension serve --resourceUrl="products/12345/variants/4567", where 12345 is the product ID and 4567 is the variant ID. If the flag is not passed, then you will be redirected to the details page of the first product in your shop.

Upgrading dependencies

Serving the extension requires using an internal node module called @shopify/admin-ui-extensions-run. Updating the CLI doesn't update the node modules automatically, so you might need to update this package manually. Run the following commands to update to the latest release:

NPM

Yarn

shopify extension register

Before you can push your code to Shopify, you need to create an app in your Partner Dashboard that you want to register your extension to. After you've created your app, run shopify extension register and select it at the prompt.

Register an extension using interactive prompts

Register an extension using options

Options

--api-key: The API key of the app that you want to register your extension to.

shopify extension push

When you're ready to publish your extension, you can upload your code to Shopify by running shopify extension push. You need to register your extension before you can push it to Shopify.

After a successful push, the CLI will generate a link to the Partner Dashboard where you can create a new version and publish your extension.

shopify extension check

Calls and runs Theme Check to analyze your code for errors and to ensure that it follows theme and Liquid best practices. Learn more about the checks that Theme Check runs.

This command is only valid for theme app extensions.

Optional parameters

Parameter Short version Description
--config <PATH> -C <PATH> The path to your custom Theme Check config. This config overrides .theme-check.yml, if it is present in the directory being analyzed.
--category <CATEGORY> -c <CATEGORY> Run only the specified category of checks. You can specify multiple categories using multiple instances of this flag.
--exclude-category <CATEGORY> -x <CATEGORY> Run all checks other than those in the specified category. You can specify multiple categories using multiple instances of this flag.
--fail-level <LEVEL> Configure the severity level that causes a run of theme check to fail (exit code 1). Options include error, suggestion, and style.
--auto-correct -a Automatically fix correctable offenses.
--init Generate a new Theme Check config file.
--print Output the active config to STDOUT.
--list -l List the active checks.
--version -v Print the version of Theme Check being used.