如何使用Big Cartel 过滤器参数,专门针对hidden_option_input?

How to use Big Cartel filter parameters, specifically for hidden_option_input?

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

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

我尝试了一些其他格式,但 none 结果添加了 class 名称。任何帮助将不胜感激!

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

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

将输出:

<input class="testing123" id="testing" name="cart[add][id]" type="hidden" value="123456">