1

我的 shopify 商店里有一些商品,它们有类似的主题商品,很好地补充了它。

我知道我可以在其中添加一个<a href链接,但我想做一些实际上是液体的一部分,并且对于我的非程序员伙伴(他也有权让我睡在沙发上)也更容易:-( ...) 添加这些链接。有没有办法使用液体格式添加链接?像This would go great with ${items.ellington-coffee-table-set}!

4

1 回答 1

1

能够 获得 像 这样 的 产品 会 很棒collections.my-collection-handle.products.my-product-handle, 但 不幸的是 , 不可能 通过 液体 手柄 获得 产品.

您必须遍历集合才能找到这样的产品:

{% for product in collections.my-collection-handle.products %}
    {% if product.handle == 'my-product-handle' %}
        {{ 'my product' | link_to: product.url }}
    {% endif %}
{% endfor %}

但是,如果您想要的只是产品的链接,那看起来很混乱,而且您仍然必须对产品的句柄进行硬编码。这会更简单:

{{ 'my product' | link_to: '/products/my-product-handle' }}

<a href=...仍然不理想,但可能比手动编码链接更好。

于 2013-11-04T03:03:05.370 回答