I’m trying to customize a theme in Shopify, using Theme Kit.
Everything was good since I noticed that after I run the command theme deploy --allow-live
, I loose all the values of the custom fields saved on Shopify.
So, for example this is the code of my file ‘homepage.intro.liquid’:
<div class="image">
<a class="banner-opacity" href="#"><img src="{{section.settings.intro_one_img | img_url: '470x570'}}"></a>
</div>
And this is a part of the schema:
{% schema %}
{
"name": "Homepage Intro",
"settings": [
{
"id": "intro_one_img",
"type": "image_picker",
"label": "Immagine 1"
},
...
{% endschema %}
So this is what I’m doing:
-
I go to Customize Theme in the Shopify Admin, I can upload and select an image without any problem and everything is working.
-
After this, let’s say I need to add a file or a folder to my theme but it’s not correctly uploaded on the Shopify admin.
-
So, I stop the ‘theme watch’ and then I run
deploy --allow-live
. -
The file or folder is correctly uploaded.
-
The image I uploaded at point 1) is not selected anymore.
And this happens with ALL the fields… and not only images but even text fields.
What am I doing wrong?
Thanks in advance.
2
Answers
You should add
config/settings_data.json
to Theme Kitconfig.yml
:I’m using ignores instead of ignore_files in the config.yml file.
And then in the .themeignore file for example:
Makes it easier to ignore multiple files and folders. Check this link for the official documentation: https://shopify.dev/themes/tools/theme-kit/configuration-reference#ignore-patterns