1
votes

Below is my piece of code and I am grabbing some items from the general settings in Shopify. The first variable settings.featured1 in curly bracket pulls the value in but inside the contains statement it doesn't. Any ideas on why?

    <h1>{{ settings.featured1 }}</h1><div class="leftArrow">&#10096</div>
    <div class="shift-scroll">
    {% for collection in collections %}
    {% if collection.handle contains settings.featured1 %}


        {% tablerow product in collection.products limit:8 %}
        <div class="one-third column alpha thumbnail even">
            <a href="{{ product.url | within: collection }}" title="{{ product.featured_image.alt | escape }}">
                <img class="scroll-img" src="{{ product.images.first | product_img_url: 'medium' }}" alt="{{ product.featured_image.alt | escape }}" />

            </a>
        </div>
        {% endtablerow %}
  {% endif %}
  {% endfor %}
  </div>
1
What is the value of settings.featured1? - JacobW
It is a string value. - Haru
I guess my thoughts are that your collection.handle is not the same as settings.featured1. Ex. It looks like shopify strips all special characters and changes a value from being "Cool Page" to "cool-page" - JacobW
Hmmm, settings.featured1 is just a variable stored in the settings on Shopify. - Haru

1 Answers

1
votes

Jacob's answer led me in the right direction. I had to downcase the setting var.

  {% assign search_term = settings.featured2 | downcase %}
  {% for collection in collections %}
  {% if collection.handle contains search_term %}