All Tutorials

Shopify App CLI Extension commands

All Tutorials

Shopify App CLI Extension commands

Shopify App CLI Extension commands

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

shopify create extension [options]

Use the shopify 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:

Terminal
$ shopify create extension
? What type of extension are you creating?
    1. Product Subscription (limit 1 per app)

Create an extension using options:

Terminal
$ shopify create extension --type=PRODUCT_SUBSCRIPTION
--name="My subscription extension"
Cloning into my_subscription_extension...

Available options

--type The type of extension that you would want to create.

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

shopify serve

In your extension’s directory, you can run shopify serve to start a local simulator. The simulator will continue to run until you press Ctrl-C.

Terminal
$ shopify serve
Project is running at http://0.0.0.0:39351/
Compiling...
Compiled successfully.

shopify register

Before you can push your code to Shopify, you must create an app on the Partners Dashboard that you want to register your extension to. Once you've created your app, run shopify register and select it at the prompt.

Register an extension using interactive prompts:

Terminal
$ shopify register
? Which app would you like to connect this extension to?
    1. My first app

Register an extension using options:

Terminal
$ shopify register --api-key=XXXXXXXXXXXXX
✓ Connected My first extension to My first app.
★ Run shopify push to push your extension to Shopify.

Options

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

shopify push

When you're ready to publish your extension, you can upload your code to Shopify by running shopify push. You must 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.

Terminal
$ shopify push
✓ Pushed to a draft on May 9, 2020 14:23:56 UTC
★ Visit https://partners.shopify.com/xxxx/apps/xxxxx/extensions/xxxx      
  to version and publish your extension