【发布时间】:2018-06-19 09:50:59
【问题描述】:
我正在尝试使用带有逗号分隔句柄列表的 Shopify 元字段(即:句柄 1、句柄 2)来调用特定的相关产品。这些相关产品显示在单独的产品页面上。我的问题是:我不知道如何从数组中获取产品进行迭代和显示。
我正在使用 Boundless 主题,因此我尝试以与收藏页面相同的方式调用/显示产品。这可能是我的问题的一部分。
由于某种原因,我当前的代码调用页面上的实际产品而不是相关产品。
这是我当前的代码:
{% if product.metafields.c_f['Shown With'] %}
{% assign shownwith = product.metafields.c_f['Shown With'] | split: ',' %}
{% capture shownwith_items %}
{% for product in shownwith %}
{% include 'product-grid-width' with product_image_type: section.settings.product_image_type, product_image_size: section.settings.product_image_size %}
{% include 'product-grid-item' with product_image_spacing: section.settings.product_image_spacing, vendor_enable: section.settings.vendor_enable %}
{% endfor %}
{% endcapture %}
{% endif %}
【问题讨论】: