首页 > 解决方案 > 使用 Liquid 将下拉框中的项目大写

问题描述

第一次使用 Liquid.. 我是一个老式的 Vbasic 程序员。我为我们的 Shopify 商店添加了一些自定义功能。我已经制定了代码机制的基本细节并使其正常工作,但我希望在创建保管箱时将项目正确大写。

  {% if section.settings.show_collection_tags and section.settings.collection_tags == 'dropdown' %}
  {% if collection.url.size == 0 %}
  {% assign collection_url = routes.all_products_collection_url %}
  {% else %}
  {% assign collection_url = collection.url %}
  {% endif %}
  {% assign has_tags = false %}
  {% capture tags_html %}
  <span class="tags filter">
    <label for="filter-by">{{ 'collections.general.filter_by' | t }}:</label>
    <select id="filter-by" class="redirect">
      <option value="{{ collection_url }}">{{ 'collections.general.all_items' | t }}</option>
      {% for tag in collection.all_tags %}
      {% unless BadTags contains tag %}
        <option value="{{ collection_url }}/{{ tag | handle }}" {% if current_tags contains tag %}selected="selected"{% endif %}>{{ tag }}</option>
      {% assign has_tags = true %}
      {% endunless %}
      {% endfor %}
    </select>
  </span>
  {% endcapture %}{% if has_tags %}{{ tags_html }}{% endif %}
  {% endif %}

我尝试使用| Capitalize以下{{{ tag | handle ,但没有奏效。

我哪里错了?

标签: shopifyliquidcapitalization

解决方案


推荐阅读