Re: Change to settings_data.json is being ignored

Solved

Change to settings_data.json is being ignored

somevegasdude
Excursionist
15 0 4

Hi, 

I've added a "subtitle" node to the "collection-list" settings in settings_data.json as shown here, but the text is not found. The spot in the HTML where the text should appear is blank.

Can anyone spot an error in my code? I am new to liquid.

Thanks!

Here's the relevant part of settings_data.json:

      "collection-list": {
        "type""collection-list",
        "settings": {
          "title""Collection List",
          "subtitle": "Whether..."   <--- this node returns blank
        }
      },
 
Here's the template code
  {% if section.settings.title != blank %}
  <div class="section-header section-header--small">
    <h2 class="section-header__title">{{ section.settings.title | escape }}</h2>
    <h3>{{ section.settings.subtitle | escape }}</h3<--- this is the new line
  </div>
  {% endif %}
 
And here's the output:
<h2 class="section-header__title">Collection List</h2> <--- this line is correct
<h3></h3>  <--- this should be "Whether..."
Accepted Solution (1)
tim
Shopify Partner
3765 351 1385

This is an accepted solution.

Theme settings are all stored in settings/settings_data.json 

Schema definitions for theme settings are stored in settings/settings_schema.json 

However, for each section it's schema is defined in respective liquid file under sections

And if you want to inject your setting into section settings, you need to add it's definition to the schema part into respective section file for it to be visible in your liquid.

However, if you inject your variable into theme settings it will be visible even without declaration.

Here are the knowledge base links for your reference: https://shopify.dev/docs/themes/sections and https://shopify.dev/docs/themes/settings 

 

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]

View solution in original post

Replies 4 (4)

tim
Shopify Partner
3765 351 1385

Do you have this new setting in section schema? Cause if you dont, it will not be loaded. (though setting from theme settings will load without being in schema :).

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]
somevegasdude
Excursionist
15 0 4

Thanks for the prompt reply. 

Are those json files? I don't see section_schema.json or theme_schema.json. I only see settings_schema.json.

...and the string 'collection-list' only occurs in these files

  • config\settings_data.json
  • sections\collection-list.liquid
  • assets\theme.js
tim
Shopify Partner
3765 351 1385

This is an accepted solution.

Theme settings are all stored in settings/settings_data.json 

Schema definitions for theme settings are stored in settings/settings_schema.json 

However, for each section it's schema is defined in respective liquid file under sections

And if you want to inject your setting into section settings, you need to add it's definition to the schema part into respective section file for it to be visible in your liquid.

However, if you inject your variable into theme settings it will be visible even without declaration.

Here are the knowledge base links for your reference: https://shopify.dev/docs/themes/sections and https://shopify.dev/docs/themes/settings 

 

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]
somevegasdude
Excursionist
15 0 4

Thank you!

It works perfectly after I added this bit to the schema in "collection-list.liquid", right under the existing "title" schema.

-------------------

    {
      "type""text",
      "id""subtitle",
      "label": {
        "en""Subtitle"
      }
    }
----------------------