order to work with Shopify locally, we need to create a Private App API in shopify store first:
To do so, we need to log into the Shopify store, and create a private app. In the Shopify Admin, go to “Apps” and click on “Manage private apps.” From there, click “Create a new private app.” You’ll need to provide a title — I usually provide the name of the client and environment for clarity. Make sure to set the permissions of “Theme templates and theme assets” to have “Read and write access” in order to generate the appropriate API credentials, then click “Save.”
Then install the Theme Kit command line:
1 2 3 4 5 6 | brew tap shopify/shopify brew install themekit |
We can get the current theme ID by the following command:
1 2 3 4 5 | theme get --list -p=[your-API-password] -s=[you-store.myshopify.com] |
Download the theme locally to add it to Git or develop locally
1 2 3 4 5 | theme download -p=[your-api-password] -s=[you-store.myshopify.com] -t=[theme-ID] |
Modify the file locally by theme watch
you can add the following code to the project folder to allow connect the project to shopify
1 2 3 4 5 | theme configure --password=[your-api-password] --store=[your-store.myshopify.com] --themeid=[your-theme-id] |
After adding that, there will be a new file in the folder root called config.yml
Now you can use the watch command to look for local changes and upload it to server:
1 2 3 4 5 | theme watch |
Shopify resources:
https://www.shopify.com.au/partners/shopify-cheat-sheet
https://shopify.github.io/liquid/tags/variable/