微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在shopify Liquid 中制作自定义系列-liquid

如何解决在shopify Liquid 中制作自定义系列-liquid

我想根据一些条件场景在 collection.liquid 中创建一个自定义集合,为此我应用了 concatappendjoin,但问题是它返回 {{ 1}} 或 ProductDropProductDropProductDropProductDrop... 而不是产品。以下是代码片段

LazyProductDropCollectionLazyProductDropCollection

我尝试了 {% assign custom_products = '' %} {% for product in collections["paneer-easy-indie-bowls"].products %} {% assign custom_products = custom_products | append: product %} {% endfor %} join 而不是 append 但返回 concat

ProductDropProductDropProductDropProductDrop...

然后我尝试了以下操作:

{% assign custom_products = custom_products | concat: product %}

但是此代码没有以正确的方式附加产品。我想要像{% capture custom_products %} {% for product in collections["paneer-easy-indie-bowls"].products %} {{ custom_products }},{{ product.handle }} {% endfor %} {% endcapture %} {% assign custom_products = custom_products | split: ',' %} {% for product in custom_products %} {{ product}} {% endfor %} 一样的产品。有什么建议吗?

解决方法

如果我正确阅读了您的伪代码,那么您正在尝试从产品集合中构建产品集合。这就引出了一个问题,为什么?既然你已经有了一个完美的收藏,就按原样使用吧!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。