【问题标题】:Unable to Concat two values in Shopify LIquid无法在 Shopify LIquid 中连接两个值
【发布时间】:2021-08-03 19:43:49
【问题描述】:

我正在尝试在 shopify 液体中将变量连接在一起,但我无法完成

这是我的sn-p

      {% for product in collections.brands.products %}
        {% assign productlist = product.title %}
        {{ productlist | join: ', ' }}
      {% endfor %}

      {% for product in collections.clothing.products %}
        {% assign productlists = product.title | join: ', ' %}
            {{ productlists | join: ', ' }}
      {% endfor %}

      {% assign allcombine = productlist | concat: productlists %}

      {{ allcombine }}

【问题讨论】:

  • 要合并成字符串格式还是要创建数组?

标签: shopify liquid


【解决方案1】:

首先你必须连接然后打印它

{% assign productlist = product.title | append: ',' %} // concat
{{ productlist }} // print

【讨论】:

    猜你喜欢
    • 2017-05-28
    • 2020-01-28
    • 2021-05-20
    • 2016-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 1970-01-01
    相关资源
    最近更新 更多