skip to Main Content

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:

  1. I go to Customize Theme in the Shopify Admin, I can upload and select an image without any problem and everything is working.

  2. 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.

  3. So, I stop the ‘theme watch’ and then I run deploy --allow-live.

  4. The file or folder is correctly uploaded.

  5. 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


  1. You should add config/settings_data.json to Theme Kit config.yml:

    development:
      password: shppa_123
      theme_id: "123"
      store: xyz.myshopify.com
      ignore_files:
      - /config/settings_data.json
    
    
    Login or Signup to reply.
  2. I’m using ignores instead of ignore_files in the config.yml file.

    development:
      password: shppa_123
      theme_id: "123"
      store: xyz.myshopify.com
      ignores:
      - .themeignore
    

    And then in the .themeignore file for example:

    # GULP
    node_modules
    
    config/settings_data.json
    

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search