【问题标题】:but titles on variants | shopify但变体的标题|购物
【发布时间】:2021-09-02 06:09:34
【问题描述】:
   {% for option in product.options_with_values %}          
   <select  class="option-selector {{option.name}}" data-var="{{forloop.index}}">             
   {% if product.available %}              
            {% for values in option.values %}
         <option value="{{values}}">{{values}}</option>
      {% endfor %}              
   {% endif %}             
   </select>            
    {% endfor %}

这是我想在样本选项之前添加标题的代码,例如 大小颜色

【问题讨论】:

  • 请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: shopify shopify-template


【解决方案1】:

根据文档,你可以像这样:

{% for product_option in product.options_with_values %}
  <label>
    {{ product_option.name }}
    <select>
      {% for value in product_option.values %}
        <option {% if product_option.selected_value == value %}selected{% endif %}>
          {{ value }}
        </option>
      {% endfor %}
    </select>
  </label>
{% endfor %}

文档Link

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-15
    • 2012-04-19
    • 2022-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多