我有相同产品的组,例如T恤和长袖。我想在产品说明下面附上三个标签,其中包含与模型相关的信息,因此每件T恤都可以重复。我想知道是否有更好的做法,而不是使用" case"?事实上,我会有大约15个标签,并且更愿意避免代码中的混乱。
<!--Start tab labels-->
<ul class="tabs">
<li><a class="active" href="#tab1">Info</a></li>
<li><a href="#tab2">Care</a></li>
<li><a href="#tab3">Details</a></li>
</ul>
<!--Start tab content-->
<ul class="tabs-content">
<li class="active" id="tab1">
{% case product_tag %}
{% when 't-shirt' %}
Our bestselling men's T shirt — in your pick of classic colors at a great price for stocking up.
{% when 'longsleeve' %}
Classic Long-Sleeve Cotton Tee features the same great fit with iconic Champion graphics.
{% endcase %}
</li>
<li id="tab2">
{% case product_tag %}
{% when 't-shirt' %}
Wash up to 40 C.
{% when 'longsleeve' %}
Wash in cold water and do not iron!
{% endcase %}
</li>
<li id="tab3">
{% case product_tag %}
{% when 't-shirt' %}
100% cotton jersey feels great, won't weigh you down. (Grey and
Heather are cotton-rich blends.)
Set-in mini-ribbed crewneck keeps its shape wash after wash.
Shoulder-to-shoulder taping helps prevent stretch-out and rip-out.
Durable double stitching reinforces cuffs and hem.
{% when 'longsleeve' %}
ll cotton comfort and breathability (Greys are a cotton-rich blend).
Ribbed cuffs and collar keep you covered.
Dyed-to-match back neck tape for no-itch comfort.
Bottom hem with clean-finish single needle stitching.
Iconic C logo on sleeve.
{% endcase %}
</li>
</ul>
答案 0 :(得分:0)
你可以使用metafields。 Metafields是可以附加到Shopify对象的自定义字段,然后referenced in Liquid.可以上传using the Shopify API,app from the App Store或using the Shopify bulk editor.
使用产品元字段看起来像这样:
<ul class="tabs-content">
<li class="active" id="tab1">
{{ product.metafields.private.extra_info }}
</li>
<li id="tab2">
{{ product.metafields.private.washing_instructions }}
</li>
<li id="tab3">
{{ product.metafields.private.further_info }}
</li>
</ul>
答案 1 :(得分:0)
如果您希望保持代码更清晰,可以将这些信息存储在页面中,然后根据其标记调用该页面的内容,例如
{{pages[product.tags.first].content}}