从shopify搜索中排除产品

时间:2019-01-21 16:54:23

标签: search filter shopify liquid shopify-template

我正在尝试排除某些带有特定标签的产品。我能够在搜索页上排除使用{%的产品,除非result.tags包含'wholesale'%},但搜索标题出现问题。我一直在修改的模板正在使用raw标记。任何人有任何建议吗?

 {% raw %}
          {{#if has_results}}
            <ul class="header-search__products grid">
              {{#each results}}
                <li class="grid__cell 1/3--handheld-and-up 1/4--desk">
                  <div class="product-item product-item--push">
                    {{#if on_sale}}
                      <div class="product-item__labels labels"><span class="label label--on-sale">{{@root.on_sale_label}}</span></div>
                    {{/if}}

                    <figure class="product-item__image-container">
                      <a href="{{url}}" class="product-item__link">
                        <img class="product-item__image " src="{{image}}" alt="{{image_alt}}">
                      </a>
                    </figure>

                    <div class="product-item__info">
                      <h3 class="product-item__title">
                        <a href="{{url}}" class="link">{{title}}</a>
                      </h3>

                      {{#if on_sale#}}
                        <span class="product-item__price product-item__price--new" data-money-convertible>{{price}}</span>
                        <span class="product-item__price product-item__price--old" data-money-convertible>{{compare_at_price}}</span>
                      {{else}}
                        <span class="product-item__price product-item__price--new" data-money-convertible>{{price}}</span>
                      {{/if}}
                    </div>
                  </div>
                </li>
              {{/each}}
            </ul>

            <a href="{{results_url}}" class="header-search__see-more button button--secondary" data-results-count="{{results_count}}">{{results_label}}</a>
          {{else}}
            <p class="header-search__no-results h4">{{results_label}}</p>
          {{/if}}
        {% endraw %}

1 个答案:

答案 0 :(得分:1)

非常感谢,您可以轻松在商店的搜索中隐藏产品。它涉及添加一些自定义元数据。

这是您要添加的数据:

"namespace" : "seo" 
"key" : "hidden"
"value" : 1
"value_type" : "integer"