お世話になります。
当方、カートページをカスタマイズしたいと考えておりまして、liquidのチートシートや海外のYouTube動画などで調べたのですが、
どうしても思うような表示にならず、こちらのフォーラムに投稿させていただきました。
=================
【要件】
・ハンドル名「cosmetics-from-japan」のコレクションに属する商品がカートに追加されている場合、カートページでその商品のタイトルの真下に「test」と表示する
=================
下記に、実際のカートページのコードを記載しております。
※表示したい箇所は、下記コードの真ん中くらいにございます。
{%- for item in cart.items -%}
{%- comment -%}
Cart item - image
{%- endcomment -%}
{%- assign image = item.image -%}
{%- assign image_widths = '120,240,394,590' -%}
{% include 'theme-rias' %}
{%- comment -%}
Cart item - title
{%- endcomment -%}
{{ item.product.title }}
{%- if section.settings.show_vendors -%}
{{ item.vendor }}
{%- endif -%}
{%- unless item.product.has_only_default_variant -%}
{{ item.variant.title }}
{%- endunless -%}
{%- comment -%}
Optional, loop through custom product line items if available
For more info on line item properties, visit:
- https://help.shopify.com/en/themes/customization/products/features/get-customization-information-for-products
{%- endcomment -%}
{%- unless item.properties == empty -%}
{%- for property in item.properties -%}
{%- unless property.last == blank -%}
{{ property.first }}: {% if property.last contains '/uploads/' %}
{{ property.last | split: '/' | last }}
{% else %}
{{ property.last }}
{% endif %}
{%- endunless -%}
{%- endfor -%}
{%- endunless -%}
//////////////////ここにtestと表示したい////////////////
{% if item.collections.handle == 'cosmetics-from-japan' %}
test
{% endif %}
//////////////////ここまで//////////////////////////////////
{%- comment -%}
Cart item - price
{%- endcomment -%}
{{ item.final_price | money }}
{%- if item.original_line_price > item.final_line_price -%}
{{ item.original_price | money }}
{%- endif -%}
{% if item.line_level_discount_allocations.size > 0 %}
{% for discount_allocation in item.line_level_discount_allocations %}
- {{ discount_allocation.discount_application.title }}
(-{{ discount_allocation.amount | money }})
{% endfor %}
{% endif %}
{%- comment -%}
Cart item - quanity
{%- endcomment -%}
{{ 'cart.general.remove' | t }}
{%- comment -%}
Cart item - total
{%- endcomment -%}
{{ 'cart.label.total' | t }}
{{ item.final_line_price | money }}
{%- if item.original_line_price > item.final_line_price -%}
{{ item.original_line_price | money }}
{%- endif -%}
{%- endfor -%}
以上となります。
何卒よろしくお願い致します。