我想将 Collection 页面中的产品添加到博客页面

I want to add the product from Collection page into Blog page

我有一个问题。如何在博客页面中导入 collection?

{%- assign collection = collections[section.settings.collection] -%}
{% for product in collection.products limit: product_limit %}
      <div class="grid__item {{ grid_item_width }}">
        {% include 'product-card-grid', grid_image_width: image_size %}
      </div>
    {% endfor %}

我试过上面的代码,但它不起作用。我想展示产品 https://www.luxilash.com/collections/3dminklashes.

嗯,我猜你没有为

设置配置
section.settings.collection

在页面模板中。您确定 section.settings.collection 对您的案例有正确的价值吗?

为方便起见,请尝试使用以下代码快照:

{%- assign collection = collections['3dminklashes'] -%}
{% for product in collection.products limit: product_limit %}
      <div class="grid__item {{ grid_item_width }}">
        {% include 'product-card-grid', grid_image_width: image_size %}
      </div>
{% endfor %}

我刚刚从您提供的 URL 中获取了收集代码。

https://www.luxilash.com/collections/3dminklashes