0

我在使用 Big Cartel 过滤器参数将类添加到隐藏输入时遇到问题。这些参数在此处的文档中列出 - https://help.bigcartel.com/developers/themes/#filters-1 - 但它们未在示例中使用。我正在尝试将一类“测试”添加到隐藏选项输入中。

      {% if product.has_default_option %}
        {{ product.option | hidden_option_input, class_name='test' }}
      {% else %}

我尝试了一些其他格式,但都没有导致添加类名。任何帮助将不胜感激!

4

1 回答 1

1

只需将参数包含为逗号分隔值,如下所示:

{{ product.option | hidden_option_input, 'testing', 'testing123' }}

将输出:

<input class="testing123" id="testing" name="cart[add][id]" type="hidden" value="123456">
于 2016-05-10T16:34:28.577 回答