是否可以选择对集合中的一种产品进行自定义并将自定义应用于同一集合中的所有产品?
例如:
如果我们为“警察”类别下的产品“XXXX”定制产品,例如添加链接、排序部分或块、插入文本部分等,我们可以将定制应用到所有属于的产品吗?在同一个“警察”类别下?
是否可以选择对集合中的一种产品进行自定义并将自定义应用于同一集合中的所有产品?
例如:
如果我们为“警察”类别下的产品“XXXX”定制产品,例如添加链接、排序部分或块、插入文本部分等,我们可以将定制应用到所有属于的产品吗?在同一个“警察”类别下?
如果我理解正确,您希望每个产品都有一个全局(相同)的部分。
好吧,如果您将它们包含在您的页面中,那么这就是当前部分所做的事情。
如果您添加{% section 'product-template' %}
并创建所有必要的选项,它们将应用于使用产品模板的每个产品。
在产品模板文件中,您可以检查集合 ID/名称,然后根据需要更新产品 UI。
<div id="productId" class="{{product.id}}" style="display:hidden" >
{% if collection.name == “Police” %}
<div class="product-detail" itemscope itemtype="http://schema.org/Product">
{% Here Your Customized UI to Show Products of Collection %}
<div class="product-detail__title-and-price">
<h1 class="product-title" itemprop="name">{{ product.title }}</h1>
<div class="price-area emphasised">
{% if variant.compare_at_price > variant.price %}
<span class="was-price theme-money">{{ variant.compare_at_price | money }}</span>
{% endif %}
<span class="price theme-money">{{ variant.price | money }}</span>
</div>
</div>
</div>
{% endif %}
<div class="product-detail" itemscope itemtype="http://schema.org/Product">
{%Your Customized UI to Show Products of Collection %}
</div>
</div>