Complete guide to Shopify CLI commands and usage for Horizon theme development
Shopify CLI is a command-line tool that helps you build Shopify themes faster. It automates and enhances your local development workflow with commands for working with themes on a Shopify store.
The most frequently used command during development.
shopify theme dev
What it does:
Uploads your local theme to a development theme on your store
Starts a local server at http://127.0.0.1:9292
Watches for file changes and syncs them automatically
Provides hot reload functionality
Injects hot reload script for instant updates
Output:
Uploading theme to development store...Serving your theme at:http://127.0.0.1:9292Synced to development theme #123456789https://your-store.myshopify.com/?preview_theme_id=123456789Watching for changes...
Options:
# Use a specific storeshopify theme dev --store your-store.myshopify.com# Use a different portshopify theme dev --port 9293# Use a specific themeshopify theme dev --theme-id 123456789# Disable hot reloadshopify theme dev --no-hot-reload# Only watch specific filesshopify theme dev --only templates/product.liquid
Select a store:1. your-store.myshopify.com2. another-store.myshopify.com> 1Select theme to update:1. Create new unpublished theme2. Dawn (live theme)3. Development theme> 1Uploading theme...✓ Theme uploaded successfullyTheme ID: 123456789
Options:
# Push as unpublished themeshopify theme push --unpublished# Push to specific themeshopify theme push --theme-id 123456789# Push specific filesshopify theme push --only templates/product.liquid# Ignore specific filesshopify theme push --ignore config/settings_data.json# Allow live theme updatesshopify theme push --allow-live
Use --allow-live with caution. Pushing to a live theme affects your production site immediately.
Download theme files from your Shopify store to your local machine.
shopify theme pull
Options:
# Pull from specific themeshopify theme pull --theme-id 123456789# Pull only specific filesshopify theme pull --only templates/# Pull and ignore specific filesshopify theme pull --ignore config/settings_data.json# Pull from live themeshopify theme pull --live
Select theme to delete:1. Old Development (ID: 123456789)2. Test Theme (ID: 987654321)> 1Are you sure you want to delete this theme? (y/n)> yDeleting theme...✓ Theme deleted successfully
Options:
# Delete specific theme by IDshopify theme delete --theme-id 123456789# Delete development themeshopify theme delete --development
# Set default storeexport SHOPIFY_FLAG_STORE="your-store.myshopify.com"# Set theme IDexport SHOPIFY_FLAG_THEME_ID="123456789"# Then run commands without flagsshopify theme dev