| name | Shopify Workflow & Tools |
| description | Shopify CLI commands, development workflow, and essential tools for theme development |
Shopify Workflow & Tools
Shopify CLI Commands
Initialize a New Theme
shopify theme init
shopify theme init --clone-url https://github.com/Shopify/dawn.git
Development Server
shopify theme dev --store=example.myshopify.com
shopify theme dev --store=example.myshopify.com --port=9293
shopify theme dev --store=example.myshopify.com --theme-editor-sync
Features:
- Hot-reload for CSS and sections
- Live preview at
http://127.0.0.1:9292
- Syncs with theme editor changes
- Chrome browser recommended
Push Theme to Shopify
shopify theme push --unpublished
shopify theme push --theme=THEME_ID
shopify theme push --development
Pull Theme from Shopify
shopify theme pull
shopify theme pull --theme=THEME_ID
shopify theme pull --only=templates/*.json,sections/*.liquid
Publish Theme
shopify theme publish --theme=THEME_ID
shopify theme list
Delete Theme
shopify theme delete --theme=THEME_ID
Check Theme for Issues
shopify theme check
shopify theme check --auto-correct
Development Workflow
1. Initial Setup
shopify theme init
cd your-theme-name
npm install
shopify theme dev --store=your-store.myshopify.com
2. Local Development
shopify theme dev --store=example.myshopify.com
3. Testing & Validation
shopify theme check
shopify theme check --auto-correct
4. Deploy to Shopify
shopify theme push --unpublished
shopify theme push --development
5. Publishing
shopify theme list
shopify theme publish --theme=THEME_ID
Theme Check
Shopify's official linting tool for themes.
Install
npm install -g @shopify/theme-check
Usage
theme-check .
theme-check . --auto-correct
theme-check sections/header.liquid
Common Checks
- Liquid syntax errors
- Performance issues
- Accessibility problems
- Deprecated tags/filters
- Missing translations
- Asset optimization
Integration with VS Code
Install the "Shopify Liquid" extension for:
- Real-time linting
- Syntax highlighting
- Autocomplete
- Hover documentation
File Structure
Required Files
your-theme/
├── config/
│ ├── settings_schema.json # Global theme settings (required)
│ └── settings_data.json # Theme setting values (auto-generated)
├── layout/
│ └── theme.liquid # Base layout (required)
├── templates/
│ ├── index.json # Homepage template (required)
│ ├── product.json # Product page template
│ ├── collection.json # Collection page template
│ └── 404.liquid # 404 page
├── sections/
│ └── *.liquid # Reusable sections
├── snippets/
│ └── *.liquid # Reusable code fragments
├── assets/
│ └── *.* # CSS, JS, images, fonts
└── locales/
└── en.default.json # Default language (required)
Environment Best Practices
Development Stores
- Free for Partners
- Sandbox for testing
- No impact on production
- Can transfer to client
Theme Environments
- Development:
shopify theme dev or --development flag
- Staging/Preview:
--unpublished flag
- Production: Published theme
Version Control
git init
echo "config/settings_data.json" >> .gitignore
echo "node_modules/" >> .gitignore
echo ".DS_Store" >> .gitignore
git add .
git commit -m "Initial theme commit"
Important: .gitignore should exclude:
config/settings_data.json (store-specific)
node_modules/ (dependencies)
.DS_Store (macOS files)
Debugging Techniques
Liquid Debugging
{%- comment -%}
Debug output using assign and display
{%- endcomment -%}
{%- assign debug = true -%}
{%- if debug -%}
<pre>
Product: {{ product | json }}
Cart: {{ cart | json }}
</pre>
{%- endif -%}
Console Logging
{% javascript %}
console.log('Product data:', {{ product | json }});
console.log('Settings:', {{ section.settings | json }});
{% endjavascript %}
Theme Check Output
shopify theme check --verbose
shopify theme check > check-results.txt
Performance Optimization
Image Optimization
{%- # Use appropriate image sizes -%}
<img
srcset="
{{ image | image_url: width: 400 }} 400w,
{{ image | image_url: width: 800 }} 800w,
{{ image | image_url: width: 1200 }} 1200w
"
sizes="(min-width: 1024px) 33vw, (min-width: 768px) 50vw, 100vw"
src="{{ image | image_url: width: 800 }}"
loading="lazy"
>
Asset Loading
{%- # Defer non-critical JavaScript -%}
<script src="{{ 'theme.js' | asset_url }}" defer></script>
{%- # Preload critical assets -%}
<link rel="preload" href="{{ 'theme.css' | asset_url }}" as="style">
Minimize Liquid Logic
{%- # Good - assign complex logic to variable -%}
{%- liquid
assign is_on_sale = false
if product.compare_at_price > product.price
assign is_on_sale = true
endif
-%}
{%- if is_on_sale -%}
<span>On Sale</span>
{%- endif -%}
{%- # Bad - inline complex logic -%}
{% if product.compare_at_price > product.price %}
<span>On Sale</span>
{% endif %}
CI/CD Integration
GitHub Actions Example
name: Deploy Theme
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Shopify CLI
run: npm install -g @shopify/cli @shopify/theme
- name: Push theme
run: shopify theme push --development
env:
SHOPIFY_CLI_THEME_TOKEN: ${{ secrets.SHOPIFY_CLI_THEME_TOKEN }}
Common Commands Reference
shopify auth login
shopify theme list
shopify theme info
shopify theme dev
shopify theme push
shopify theme pull
shopify theme publish
shopify theme delete
shopify theme check
shopify theme package
theme-check .
theme-check . --auto-correct
theme-check . --config=.theme-check.yml
shopify theme --help
shopify theme dev --help
Troubleshooting
Development Server Not Starting
lsof -i :9292
shopify theme dev --port=9293
Authentication Issues
shopify auth logout
shopify auth login
Theme Push Conflicts
shopify theme push --force
shopify theme pull
shopify theme push
Hot Reload Not Working
- Ensure using Chrome browser
- Check file paths are correct
- Restart dev server
- Clear browser cache
Best Practices
- Use development stores for testing
- Push unpublished first before publishing
- Run theme check before deploying
- Use version control (Git)
- Exclude settings_data.json from Git
- Test on multiple devices before publishing
- Keep CLI updated:
npm update -g @shopify/cli
- Use theme editor sync during development
- Document custom features in README
- Follow Shopify theme requirements for Theme Store
Use these tools and workflows to build, test, and deploy Shopify themes efficiently.